- All Known Implementing Classes:
AbstractInventory
,AnvilInventory
,BeaconInventory
,BrewingStandInventory
,EnchantmentTableInventory
,FurnaceInventory
,Inventory
,PlayerInventory
,VillagerInventory
Represents an inventory which can receive click input.
All methods returning boolean returns true if the action is successful, false otherwise.
See the Minecraft wiki for more information.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
callClickEvent
(Player player, AbstractInventory inventory, int slot, ClickType clickType, ItemStack clicked, ItemStack cursor) boolean
changeHeld
(Player player, int slot, int key) Called when aPlayer
held click in the inventoryboolean
doubleClick
(Player player, int slot) Called when aPlayer
double click in the inventoryboolean
boolean
Called when aPlayer
press the drop buttondefault boolean
handleClick
(Player player, Click click) Parses a click.boolean
Called when aPlayer
left click in the inventory.boolean
middleClick
(Player player, int slot) boolean
rightClick
(Player player, int slot) Called when aPlayer
right click in the inventory.boolean
shiftClick
(Player player, int slot, int button) Called when aPlayer
shift click in the inventory
-
Method Details
-
handleClick
Parses a click. This delegates to each individual implementation method.- Parameters:
player
- the player who clickedclick
- the click that occurred- Returns:
- whether or not the click was a success
-
leftClick
Called when aPlayer
left click in the inventory. Can also be to drop the cursor item- Parameters:
player
- the player who clickedslot
- the slot number- Returns:
- true if the click hasn't been cancelled, false otherwise
-
rightClick
Called when aPlayer
right click in the inventory. Can also be to drop the cursor item- Parameters:
player
- the player who clickedslot
- the slot number- Returns:
- true if the click hasn't been cancelled, false otherwise
-
shiftClick
Called when aPlayer
shift click in the inventory- Parameters:
player
- the player who clickedslot
- the slot numberbutton
- the button (same behaviour in vanilla, but can be used for custom behaviour)- Returns:
- true if the click hasn't been cancelled, false otherwise
-
changeHeld
Called when aPlayer
held click in the inventory- Parameters:
player
- the player who clickedslot
- the slot numberkey
- the held slot (0-8) pressed- Returns:
- true if the click hasn't been cancelled, false otherwise
-
middleClick
-
drop
Called when aPlayer
press the drop button- Parameters:
player
- the player who clickedall
-slot
- the slot number (-999 if clicking outside, i.e. dropping cursor)- Returns:
- true if the drop hasn't been cancelled, false otherwise
-
dragging
-
doubleClick
Called when aPlayer
double click in the inventory- Parameters:
player
- the player who clickedslot
- the slot number- Returns:
- true if the click hasn't been cancelled, false otherwise
-
callClickEvent
default void callClickEvent(Player player, AbstractInventory inventory, int slot, ClickType clickType, ItemStack clicked, ItemStack cursor)
-