Hopperlib
Loading...
Searching...
No Matches
cc.mrcl.hopperlib.CustomItems.HopperItem Class Referenceabstract

Public Member Functions

boolean isHopperItem (ItemStack itemStack)
abstract ItemStack getDefaultItem ()
abstract void onBlockUse (Player player, ItemStack itemStack, Block block, BlockFace blockFace)
abstract void onAirUse (Player player, ItemStack itemStack)
abstract boolean onDeviceDrop (Player player, boolean isShifting, Item dropped)

Static Protected Attributes

static final NamespacedKey HOPPER_ITEM_TYPE = new NamespacedKey(HopperLib.getInstance(),"hopper_item")

Member Function Documentation

◆ getDefaultItem()

abstract ItemStack cc.mrcl.hopperlib.CustomItems.HopperItem.getDefaultItem ( )
abstract

Defines the custom itemstack to be used by default. It MUST have a HOPPER_ITEM_TYPE String persistent container.

Returns
The item definition.

◆ isHopperItem()

boolean cc.mrcl.hopperlib.CustomItems.HopperItem.isHopperItem ( ItemStack itemStack)

Checks if an item is a HopperItem of this type.

Parameters
itemStackThe item to check.
Returns
Whether the item is or isn't this custom item.

◆ onAirUse()

abstract void cc.mrcl.hopperlib.CustomItems.HopperItem.onAirUse ( Player player,
ItemStack itemStack )
abstract

Executed when a player right clicks with this item on the air.

Parameters
playerThe player who right-clicked.
itemStackThe itemstack that corresponds to this item

◆ onBlockUse()

abstract void cc.mrcl.hopperlib.CustomItems.HopperItem.onBlockUse ( Player player,
ItemStack itemStack,
Block block,
BlockFace blockFace )
abstract

Executed when a player right clicks with this item on a block.

Parameters
playerThe player who right-clicked.
itemStackThe itemstack that corresponds to this item
blockThe block the item was right-clicked on.
blockFaceThe blockface the player right-clicked.

◆ onDeviceDrop()

abstract boolean cc.mrcl.hopperlib.CustomItems.HopperItem.onDeviceDrop ( Player player,
boolean isShifting,
Item dropped )
abstract

Executed when a player drops this custom item

Returns
Cancellation of the event, true if the drop event should be cancelled
Parameters
droppedThe item entity that was dropped, can be killed.
playerThe player that dropped the item
isShiftingWhether the player was shifting or not when the item was dropped

The documentation for this class was generated from the following file:
  • src/main/java/cc/mrcl/hopperlib/CustomItems/HopperItem.java