Package net.minestom.server.item.rule
Class VanillaStackingRule
java.lang.Object
net.minestom.server.item.rule.VanillaStackingRule
- All Implemented Interfaces:
StackingRule
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull ItemStackChanges the size of theItemStacktonewAmount.booleanUsed to know if anItemStackcan have the sizenewAmountapplied.booleancanBeStacked(@NotNull ItemStack item1, @NotNull ItemStack item2) Used to know if twoItemStackcan be stacked together.booleanintUsed to determine the current stack size of anItemStack.intgetMaxSize(@NotNull ItemStack itemStack) Gets the max size of a stack.Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minestom.server.item.StackingRule
apply
-
Constructor Details
-
VanillaStackingRule
public VanillaStackingRule()
-
-
Method Details
-
canBeStacked
Description copied from interface:StackingRuleUsed to know if twoItemStackcan be stacked together.- Specified by:
canBeStackedin interfaceStackingRule- Parameters:
item1- the firstItemStackitem2- the secondItemStack- Returns:
- true if both
ItemStackcan be stacked together (without taking their amount in consideration)
-
canApply
Description copied from interface:StackingRuleUsed to know if anItemStackcan have the sizenewAmountapplied.- Specified by:
canApplyin interfaceStackingRule- Parameters:
item- theItemStackto checknewAmount- the desired new amount- Returns:
- true if
itemcan have its stack size set to newAmount
-
apply
Description copied from interface:StackingRuleChanges the size of theItemStacktonewAmount. At this point we know that the item can have this stack size applied.- Specified by:
applyin interfaceStackingRule- Parameters:
item- theItemStackto applies the size toamount- the new item size- Returns:
- a new
itemwith the specified amount
-
getAmount
Description copied from interface:StackingRuleUsed to determine the current stack size of anItemStack. It is possible to have it stored in its nbt.- Specified by:
getAmountin interfaceStackingRule- Parameters:
itemStack- theItemStackto check the size- Returns:
- the correct size of
ItemStack
-
getMaxSize
Description copied from interface:StackingRuleGets the max size of a stack.- Specified by:
getMaxSizein interfaceStackingRule- Parameters:
itemStack- the item to get the max size from- Returns:
- the max size of a stack
-
equals
-