All Implemented Interfaces:
IBuilding, IBuildingContainer, ICommonBuilding, ISchematicProvider, IBuildingModuleContainer, IModuleContainer<IBuildingModule>, IRequester, IRequestResolverProvider, IItemHandlerCapProvider, net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>

public class BuildingFarmer extends AbstractBuilding
Class which handles the farmer building.
  • Field Details

  • Constructor Details

    • BuildingFarmer

      public BuildingFarmer(IColony c, net.minecraft.core.BlockPos l)
      Public constructor which instantiates the building.
      Parameters:
      c - the colony the building is in.
      l - the position it has been placed (it's id).
  • Method Details

    • canBeGathered

      public boolean canBeGathered()
      Description copied from class: AbstractBuilding
      Check if the building should be gathered by the dman.
      Specified by:
      canBeGathered in interface IBuilding
      Overrides:
      canBeGathered in class AbstractBuilding
      Returns:
      true if so.
    • getRequiredItemsAndAmount

      public Map<Predicate<net.minecraft.world.item.ItemStack>,net.minecraft.util.Tuple<Integer,Boolean>> getRequiredItemsAndAmount()
      Override this method if you want to keep an amount of items in inventory. When the inventory is full, everything get's dumped into the building chest. But you can use this method to hold some stacks back.
      Specified by:
      getRequiredItemsAndAmount in interface IBuilding
      Overrides:
      getRequiredItemsAndAmount in class AbstractBuilding
      Returns:
      a map of objects which should be kept.
    • canEat

      public boolean canEat(net.minecraft.world.item.ItemStack stack)
      Description copied from interface: IBuilding
      Check if the assigned citizens are allowed to eat the following stack.
      Parameters:
      stack - the stack to test.
      Returns:
      true if so.
    • getMaxBuildingLevel

      public int getMaxBuildingLevel()
      Description copied from interface: ISchematicProvider
      Children must return their max building level.
      Specified by:
      getMaxBuildingLevel in interface ISchematicProvider
      Overrides:
      getMaxBuildingLevel in class AbstractBuilding
      Returns:
      Max building level.
    • getSchematicName

      @NotNull public @NotNull String getSchematicName()
      Description copied from interface: ISchematicProvider
      Children must return the name of their structure.
      Returns:
      StructureProxy name.
    • requestFertilizer

      public boolean requestFertilizer()
      Getter for request fertilizer
    • getWorkingOffset

      public net.minecraft.core.BlockPos getWorkingOffset()
      Get the offset to work at relative to the scarecrow.
      Returns:
      the blockpos.
    • setCell

      public int setCell(int i)
      Set the current index within the current field
      Parameters:
      i - the value to set.
      Returns:
      current value.
    • getCell

      public int getCell()
      Get the current index within the current field
      Returns:
      current value.
    • setPrevPos

      public void setPrevPos(net.minecraft.core.BlockPos position)
      Set the previous position which has been worked at.
      Parameters:
      position - to set.
    • setWorkingOffset

      public void setWorkingOffset(net.minecraft.core.BlockPos blockPos)
      Set the offset to work at relative to the scarecrow.
      Parameters:
      blockPos - the pos to set.
    • getPrevPos

      public net.minecraft.core.BlockPos getPrevPos()
      Get the previous position which has been worked at.
      Returns:
      current prev pos.
    • serializeNBT

      public net.minecraft.nbt.CompoundTag serializeNBT(net.minecraft.core.HolderLookup.Provider provider)
      Specified by:
      serializeNBT in interface IBuildingContainer
      Specified by:
      serializeNBT in interface net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
      Overrides:
      serializeNBT in class AbstractBuilding
    • deserializeNBT

      public void deserializeNBT(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound)
      Specified by:
      deserializeNBT in interface IBuildingContainer
      Specified by:
      deserializeNBT in interface net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
      Overrides:
      deserializeNBT in class AbstractBuilding