Package net.minestom.server.item.rule
Class VanillaStackingRule
java.lang.Object
net.minestom.server.item.rule.VanillaStackingRule
- All Implemented Interfaces:
StackingRule
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@NotNull ItemStack
Changes the size of theItemStack
tonewAmount
.boolean
Used to know if anItemStack
can have the sizenewAmount
applied.boolean
canBeStacked
(@NotNull ItemStack item1, @NotNull ItemStack item2) Used to know if twoItemStack
can be stacked together.boolean
int
Used to determine the current stack size of anItemStack
.int
getMaxSize
(@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, wait
Methods inherited from interface net.minestom.server.item.StackingRule
apply
-
Constructor Details
-
VanillaStackingRule
public VanillaStackingRule()
-
-
Method Details
-
canBeStacked
Description copied from interface:StackingRule
Used to know if twoItemStack
can be stacked together.- Specified by:
canBeStacked
in interfaceStackingRule
- Parameters:
item1
- the firstItemStack
item2
- the secondItemStack
- Returns:
- true if both
ItemStack
can be stacked together (without taking their amount in consideration)
-
canApply
Description copied from interface:StackingRule
Used to know if anItemStack
can have the sizenewAmount
applied.- Specified by:
canApply
in interfaceStackingRule
- Parameters:
item
- theItemStack
to checknewAmount
- the desired new amount- Returns:
- true if
item
can have its stack size set to newAmount
-
apply
Description copied from interface:StackingRule
Changes the size of theItemStack
tonewAmount
. At this point we know that the item can have this stack size applied.- Specified by:
apply
in interfaceStackingRule
- Parameters:
item
- theItemStack
to applies the size toamount
- the new item size- Returns:
- a new
item
with the specified amount
-
getAmount
Description copied from interface:StackingRule
Used to determine the current stack size of anItemStack
. It is possible to have it stored in its nbt.- Specified by:
getAmount
in interfaceStackingRule
- Parameters:
itemStack
- theItemStack
to check the size- Returns:
- the correct size of
ItemStack
-
getMaxSize
Description copied from interface:StackingRule
Gets the max size of a stack.- Specified by:
getMaxSize
in interfaceStackingRule
- Parameters:
itemStack
- the item to get the max size from- Returns:
- the max size of a stack
-
equals
-