Class PlantationField

java.lang.Object
com.minecolonies.core.colony.buildingextensions.AbstractBuildingExtensionModule
com.minecolonies.core.colony.buildingextensions.PlantationField
All Implemented Interfaces:
IBuildingExtension, IModuleContainer<IBuildingExtensionModule>

public class PlantationField extends AbstractBuildingExtensionModule
Field class implementation for the plantation
  • 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

      public boolean isValidPlacement(IColony colony)
      Description copied from interface: IBuildingExtension
      Condition 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

      public List<net.minecraft.core.BlockPos> getWorkingPositions()
      Get the list of working positions of this field.
      Returns:
      an unmodifiable collection of working positions.
    • setWorkingPositions

      public void setWorkingPositions(List<net.minecraft.core.BlockPos> workingPositions)
      Overwrite the working positions on the field instance.
      Parameters:
      workingPositions - the new list of working positions.
    • getModule

      public IPlantationModule 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: IBuildingExtension
      Stores the NBT data of the building extension.
      Specified by:
      serializeNBT in interface IBuildingExtension
      Overrides:
      serializeNBT in class AbstractBuildingExtensionModule
    • deserializeNBT

      public void deserializeNBT(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound)
      Description copied from interface: IBuildingExtension
      Reconstruct the building extension from the given NBT data.
      Specified by:
      deserializeNBT in interface IBuildingExtension
      Overrides:
      deserializeNBT in class AbstractBuildingExtensionModule
      Parameters:
      compound - the compound to read from.
    • serialize

      public void serialize(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf buf)
      Description copied from interface: IBuildingExtension
      Serialize a building extension to a buffer.
      Specified by:
      serialize in interface IBuildingExtension
      Overrides:
      serialize in class AbstractBuildingExtensionModule
      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: IBuildingExtension
      Deserialize a building extension from a buffer.
      Specified by:
      deserialize in interface IBuildingExtension
      Overrides:
      deserialize in class AbstractBuildingExtensionModule
      Parameters:
      buf - the buffer to read the building extension data from.