Class BuildingBuilderResource
java.lang.Object
com.minecolonies.api.crafting.ItemStorage
com.minecolonies.core.colony.buildings.utils.BuildingBuilderResource
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)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classComparator class for BuildingBuilderResource.static enumAvailability status of the resource. -
Field Summary
Fields inherited from class com.minecolonies.api.crafting.ItemStorage
shouldIgnoreDamageValue, shouldIgnoreNBTValue -
Constructor Summary
ConstructorsConstructorDescriptionBuildingBuilderResource(@NotNull net.minecraft.world.item.ItemStack stack, int amount) Constructor for a resource.BuildingBuilderResource(@NotNull net.minecraft.world.item.ItemStack stack, int amount, int available) Constructor for a resource but with available items. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAvailable(int amount) Add to the current amount available.booleanintintget the amount available for this resource.intget how much more is needed from the player.getName()intget how the player have in its inventory.inthashCode()voidsetAmountInDelivery(int amountInDelivery) voidsetAvailable(int amount) Setter for the available resource amount.voidsetPlayerAmount(int amount) set how the player have in its inventory.toString()Methods inherited from class com.minecolonies.api.crafting.ItemStorage
copy, getAmount, getDamageValue, getItem, getItemStack, getItemStackOfListMatchingPredicate, getRemainingDurablityValue, ignoreDamageValue, ignoreNBT, isEmpty, matchDefinitionEquals, setAmount, toImmutable
-
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
- Overrides:
toStringin classItemStorage
-
getName
-
getAvailabilityStatus
-
hashCode
public int hashCode()- Overrides:
hashCodein classItemStorage
-
equals
- Overrides:
equalsin classItemStorage
-
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)
-