Class PlantationField
java.lang.Object
com.minecolonies.core.colony.buildingextensions.AbstractBuildingExtensionModule
com.minecolonies.core.colony.buildingextensions.PlantationField
- All Implemented Interfaces:
IBuildingExtension,IModuleContainer<IBuildingExtensionModule>
Field class implementation for the plantation
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.minecolonies.api.colony.buildingextensions.IBuildingExtension
IBuildingExtension.ExtensionId -
Constructor Summary
ConstructorsConstructorDescriptionPlantationField(BuildingExtensionRegistries.BuildingExtensionEntry fieldType, @NotNull net.minecraft.core.BlockPos position) Constructor used in NBT deserialization. -
Method Summary
Modifier and TypeMethodDescriptionstatic PlantationFieldcreate(BuildingExtensionRegistries.BuildingExtensionEntry fieldEntry, net.minecraft.core.BlockPos position) Constructor to create new instancesvoiddeserialize(@NotNull net.minecraft.network.FriendlyByteBuf buf) Deserialize a building extension from a buffer.voiddeserializeNBT(@NotNull net.minecraft.nbt.CompoundTag compound) Reconstruct the building extension from the given NBT data.Get the plantation module on this field.List<net.minecraft.core.BlockPos>Get the list of working positions of this field.booleanisValidPlacement(IColony colony) Condition to check whether this building extension instance is currently properly placed down.voidserialize(@NotNull net.minecraft.network.FriendlyByteBuf buf) Serialize a building extension to a buffer.@NotNull net.minecraft.nbt.CompoundTagStores the NBT data of the building extension.voidsetWorkingPositions(List<net.minecraft.core.BlockPos> workingPositions) Overwrite the working positions on the field instance.Methods inherited from class com.minecolonies.core.colony.buildingextensions.AbstractBuildingExtensionModule
equals, getBuildingExtensionType, getBuildingId, getClassType, getId, getModules, getPosition, getSqDistance, hashCode, isTaken, registerModule, resetOwningBuilding, setBuildingMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.minecolonies.api.colony.modules.IModuleContainer
getFirstModuleOccurance, getModule, getModule, getModule, getModuleMatching, getModules, getModules, getModules, getModulesByType, hasModule, hasModule, hasModule
-
Constructor Details
-
PlantationField
public PlantationField(@NotNull BuildingExtensionRegistries.BuildingExtensionEntry fieldType, @NotNull @NotNull net.minecraft.core.BlockPos position) Constructor used in NBT deserialization.- Parameters:
fieldType- the type of field.position- the position of the field.
-
-
Method Details
-
create
public static PlantationField create(BuildingExtensionRegistries.BuildingExtensionEntry fieldEntry, net.minecraft.core.BlockPos position) Constructor to create new instances- Parameters:
fieldEntry- the type of field we want to produce.position- the position it is placed in.
-
isValidPlacement
Description copied from interface:IBuildingExtensionCondition to check whether this building extension instance is currently properly placed down.- Parameters:
colony- the colony this building extension is in.- Returns:
- true if the building extension is correctly placed at the current position.
-
getWorkingPositions
Get the list of working positions of this field.- Returns:
- an unmodifiable collection of working positions.
-
setWorkingPositions
Overwrite the working positions on the field instance.- Parameters:
workingPositions- the new list of working positions.
-
getModule
Get the plantation module on this field.- Returns:
- the plantation module instance.
-
serializeNBT
@NotNull public @NotNull net.minecraft.nbt.CompoundTag serializeNBT()Description copied from interface:IBuildingExtensionStores the NBT data of the building extension.- Specified by:
serializeNBTin interfaceIBuildingExtension- Overrides:
serializeNBTin classAbstractBuildingExtensionModule
-
deserializeNBT
public void deserializeNBT(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound) Description copied from interface:IBuildingExtensionReconstruct the building extension from the given NBT data.- Specified by:
deserializeNBTin interfaceIBuildingExtension- Overrides:
deserializeNBTin classAbstractBuildingExtensionModule- Parameters:
compound- the compound to read from.
-
serialize
public void serialize(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf buf) Description copied from interface:IBuildingExtensionSerialize a building extension to a buffer.- Specified by:
serializein interfaceIBuildingExtension- Overrides:
serializein classAbstractBuildingExtensionModule- Parameters:
buf- the buffer to write the building extension data to.
-
deserialize
public void deserialize(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf buf) Description copied from interface:IBuildingExtensionDeserialize a building extension from a buffer.- Specified by:
deserializein interfaceIBuildingExtension- Overrides:
deserializein classAbstractBuildingExtensionModule- Parameters:
buf- the buffer to read the building extension data from.
-