Class BuildingPlantation

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 BuildingPlantation extends AbstractBuilding
Class of the plantation building. Worker will grow sugarcane/bamboo/cactus + craft paper and books.
  • Constructor Details

    • BuildingPlantation

      public BuildingPlantation(IColony c, net.minecraft.core.BlockPos l)
      Instantiates a new plantation building.
      Parameters:
      c - the colony.
      l - the location
  • Method Details

    • onPlacement

      public void onPlacement()
      Description copied from class: AbstractBuilding
      On setting down the building.
      Specified by:
      onPlacement in interface IBuilding
      Overrides:
      onPlacement in class AbstractBuilding
    • deserializeNBT

      public void deserializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound)
      TODO: future Legacy code, can be removed when plantations will no longer have to support fields directly from the hut building.

      This is used for initial migration to the new plantation field system. This will register the fields on colony load, only when the building still contains old NBT data.

      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
    • onUpgradeComplete

      public void onUpgradeComplete(@Nullable @Nullable com.ldtteam.structurize.blueprints.v1.Blueprint blueprint, int newLevel)
      Description copied from interface: IBuilding
      Called upon completion of an upgrade process. We suppress this warning since this parameter will be used in child classes which override this method.
      Specified by:
      onUpgradeComplete in interface IBuilding
      Overrides:
      onUpgradeComplete in class AbstractBuilding
      Parameters:
      newLevel - The new level.
    • getRequiredItemsAndAmount

      public Map<Predicate<net.minecraft.world.item.ItemStack>,net.minecraft.util.Tuple<Integer,Boolean>> getRequiredItemsAndAmount()
      Description copied from class: AbstractBuilding
      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 list of objects which should be kept.
    • canEat

      public boolean canEat(net.minecraft.world.item.ItemStack stack)
      Check if the assigned citizens are allowed to eat the following stack. Additionally, if the stack is even edible in the first place, then it also checks if the fields aren't producing these items. If this item is being produced here, the planter is not allowed to eat his own products in that case. (Although most items the planter produces won't be edible to begin with).
      Parameters:
      stack - the stack to test.
      Returns:
      true if so.
    • setTileEntity

      public void setTileEntity(AbstractTileEntityColonyBuilding te)
      TODO: future Legacy code, can be removed when plantations will no longer have to support fields directly from the hut building.
      Specified by:
      setTileEntity in interface IBuildingContainer
      Overrides:
      setTileEntity in class AbstractBuildingContainer
      Parameters:
      te - The tileentity
    • getSchematicName

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