Class BoxStickItem
java.lang.Object
net.okocraft.box.feature.stick.item.BoxStickItem
A record to hold a key representing that the item is a Box Stick and provide methods to check if the
ItemStack is Box Item.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if theItemStackis a Box Stick.booleaninthashCode()@NotNull NamespacedKeykey()Gets theNamespacedKeythat is used for saving data toPersistentDataContainer.voidonRightClick(@NotNull Consumer<Player> onRightClick) Sets the action called when thePlayerright-clicked.voidonRightClick(@NotNull Player player) Calls the action of right-clickvoidsaveBoxStickKey(@NotNull PersistentDataContainer target) Saves thekey()toPersistentDataContainertoString()
-
Constructor Details
-
BoxStickItem
The constructor ofBoxStickItem.- Parameters:
key- theNamespacedKeyto use for representing that the item is a Box Stick
-
-
Method Details
-
saveBoxStickKey
Saves thekey()toPersistentDataContainer- Parameters:
target- the targetPersistentDataContainer
-
check
Checks if theItemStackis a Box Stick.- Parameters:
itemStack- theItemStackto check- Returns:
- if the
ItemStackhaskey()inPersistentDataContainer, returnstrue, otherwisefalse
-
key
Gets theNamespacedKeythat is used for saving data toPersistentDataContainer.- Returns:
- the
NamespacedKeythat is used for saving data toPersistentDataContainer
-
onRightClick
Sets the action called when thePlayerright-clicked.- Parameters:
onRightClick- the action on right-click
-
onRightClick
Calls the action of right-click- Parameters:
player- thePlayerwho clicked
-
equals
-
hashCode
public int hashCode() -
toString
-