Class BuildingResourcesModule

java.lang.Object
com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
com.minecolonies.core.colony.buildings.modules.BuildingResourcesModule
All Implemented Interfaces:
IBuildingModule, IPersistentModule, IHasDirty

public class BuildingResourcesModule extends AbstractBuildingModule implements IPersistentModule
The structureBuilder building.
  • Constructor Details

    • BuildingResourcesModule

      public BuildingResourcesModule()
  • Method Details

    • deserializeNBT

      public void deserializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound)
      Description copied from interface: IPersistentModule
      Deserialize the module.
      Specified by:
      deserializeNBT in interface IPersistentModule
      Parameters:
      compound - the nbt compound.
    • serializeNBT

      public void serializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound)
      Description copied from interface: IPersistentModule
      Serialize the module from a compound.
      Specified by:
      serializeNBT in interface IPersistentModule
      Parameters:
      compound - the compound.
    • serializeToView

      public void serializeToView(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf)
      Method to serialize data to send it to the view.
      Specified by:
      serializeToView in interface IBuildingModule
      Parameters:
      buf - the used ByteBuffer.
    • getNeededResources

      public Map<String,BuildingBuilderResource> getNeededResources()
      Get the needed resources for the current build.
      Returns:
      a new Hashmap.
    • getRequiredResources

      @Nullable public @Nullable BuilderBucket getRequiredResources()
      Get the needed resources for the current build.
      Returns:
      the bucket.
    • getResourceFromIdentifier

      public BuildingBuilderResource getResourceFromIdentifier(String res)
      Get the resource from the identifier.
      Parameters:
      res - the resource to get.
      Returns:
      the resource.
    • addNeededResource

      public void addNeededResource(@Nullable @Nullable net.minecraft.world.item.ItemStack res, int amount)
      Add a new resource to the needed list.
      Parameters:
      res - the resource.
      amount - the amount.
    • reduceNeededResource

      public void reduceNeededResource(net.minecraft.world.item.ItemStack res, int amount)
      Reduce a resource of the needed list.
      Parameters:
      res - the resource.
      amount - the amount.
    • resetNeededResources

      public void resetNeededResources()
      Resets the needed resources completely.
    • requiresResourceForBuilding

      public boolean requiresResourceForBuilding(net.minecraft.world.item.ItemStack stack)
      Check if the structureBuilder requires a certain ItemStack for the current construction.
      Parameters:
      stack - the stack to test.
      Returns:
      true if so.
    • checkOrRequestBucket

      public void checkOrRequestBucket(@Nullable @Nullable BuilderBucket requiredResources, ICitizenData worker)
      Check or request if the contents of a specific batch are in the inventory of the building. This ignores the worker inventory (that is remaining stuff from previous rounds, or already belongs to another bucket)
      Parameters:
      requiredResources - the bucket to check and request.
      worker - the worker.
    • nextStage

      public void nextStage()
      Go to the next stage.
    • setTotalStages

      public void setTotalStages(int total)
      Set the total number of stages.
      Parameters:
      total - the total.
    • getNextBucket

      @Nullable public @Nullable BuilderBucket getNextBucket()
      Return the next bucket to work on.
      Returns:
      the next bucket or a tuple with null inside if non available.