Class BuildingBuilderResource

java.lang.Object
com.minecolonies.api.crafting.ItemStorage
com.minecolonies.core.colony.buildings.utils.BuildingBuilderResource

public class BuildingBuilderResource extends ItemStorage
Information about a resource. - How many are needed to finish the build - How many are available to the builder - How many are in the player's inventory (client side only)
  • Constructor Details

    • BuildingBuilderResource

      public BuildingBuilderResource(@NotNull @NotNull net.minecraft.world.item.ItemStack stack, int amount, int available)
      Constructor for a resource but with available items.
      Parameters:
      stack - the stack.
      amount - the amount.
      available - the amount available.
    • BuildingBuilderResource

      public BuildingBuilderResource(@NotNull @NotNull net.minecraft.world.item.ItemStack stack, int amount)
      Constructor for a resource.
      Parameters:
      stack - the stack.
      amount - amount for this resource.
  • Method Details

    • addAvailable

      public void addAvailable(int amount)
      Add to the current amount available.
      Parameters:
      amount - to add to the current amount available
    • getMissingFromPlayer

      public int getMissingFromPlayer()
      get how much more is needed from the player.

      This is taking the builder's inventory + chest into account and the player inventory Negative number is when the player does not have enough Negative number is when the player does not more than enough

      Returns:
      the amount needed
    • toString

      public String toString()
      Overrides:
      toString in class ItemStorage
    • getName

      public String getName()
    • getAvailabilityStatus

      public BuildingBuilderResource.RessourceAvailability getAvailabilityStatus()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class ItemStorage
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class ItemStorage
    • getAvailable

      public int getAvailable()
      get the amount available for this resource.

      i.e. amount in the chest + amount in the builder's inventory

      Returns:
      the amount available
    • setAvailable

      public void setAvailable(int amount)
      Setter for the available resource amount.
      Parameters:
      amount - this is the new amount available
    • getPlayerAmount

      public int getPlayerAmount()
      get how the player have in its inventory.
      Returns:
      the amount
    • setPlayerAmount

      public void setPlayerAmount(int amount)
      set how the player have in its inventory.
      Parameters:
      amount - of items
    • getAmountInDelivery

      public int getAmountInDelivery()
    • setAmountInDelivery

      public void setAmountInDelivery(int amountInDelivery)