All Implemented Interfaces:
IBuildingExtension, IModuleContainer<IBuildingExtensionModule>

public class FarmField extends AbstractBuildingExtensionModule
Field class implementation for the plantation
  • Field Details

  • Constructor Details

    • FarmField

      public FarmField(BuildingExtensionRegistries.BuildingExtensionEntry fieldType, 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 FarmField create(net.minecraft.core.BlockPos position, net.minecraft.world.level.Level worldIn)
      Constructor to create new instances
      Parameters:
      position - the position it is placed in.
      worldIn -
    • 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.
    • 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.
    • getSeed

      @NotNull public @NotNull net.minecraft.world.item.ItemStack getSeed()
      Get the current seed on the field.
      Returns:
      the current seed.
    • setSeed

      public void setSeed(net.minecraft.world.item.ItemStack seed)
      Updates the seed in the field.
      Parameters:
      seed - the new seed
    • nextState

      public void nextState()
      Move the field into the new state.
    • getFieldStage

      public FarmField.Stage getFieldStage()
      Get the current stage the field is in.
      Returns:
      the stage of the field.
    • setFieldStage

      public void setFieldStage(FarmField.Stage fieldStage)
      Sets the current stage of the field.
      Parameters:
      fieldStage - the stage of the field.
    • getRadius

      public int getRadius(net.minecraft.core.Direction direction)
      Parameters:
      direction - the direction to get the range for
      Returns:
      the radius
    • setRadius

      public void setRadius(net.minecraft.core.Direction direction, int radius)
      Parameters:
      direction - the direction for the radius
      radius - the number of blocks from the scarecrow that the farmer will work with
    • isNoPartOfField

      public boolean isNoPartOfField(@NotNull @NotNull net.minecraft.world.level.Level world, @NotNull @NotNull net.minecraft.core.BlockPos position)
      Checks if a certain position is part of the field. Complies with the definition of field block.
      Parameters:
      world - the world object.
      position - the position.
      Returns:
      true if it is.