mirror of
https://github.com/Minestom/Minestom.git
synced 2025-03-02 11:21:15 +01:00
Added ItemStack#onInventoryClick
This commit is contained in:
parent
975bdcf3ed
commit
23e82e0ae2
@ -508,6 +508,12 @@ public class InventoryClickProcessor {
|
||||
slot = slot - inventorySlot + PlayerInventoryUtils.OFFSET;
|
||||
}
|
||||
|
||||
{
|
||||
if (clicked != null) {
|
||||
clicked.onInventoryClick(player, clickType, slot, isPlayerInventory);
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the didCloseInventory field
|
||||
// Wait for inventory conditions + events to possibly close the inventory
|
||||
player.UNSAFE_changeDidCloseInventory(false);
|
||||
|
@ -4,6 +4,7 @@ import net.minestom.server.chat.ColoredText;
|
||||
import net.minestom.server.data.Data;
|
||||
import net.minestom.server.data.DataContainer;
|
||||
import net.minestom.server.entity.Player;
|
||||
import net.minestom.server.inventory.click.ClickType;
|
||||
import net.minestom.server.item.attribute.ItemAttribute;
|
||||
import net.minestom.server.item.metadata.*;
|
||||
import net.minestom.server.item.rule.VanillaStackingRule;
|
||||
@ -649,4 +650,18 @@ public class ItemStack implements DataContainer {
|
||||
public boolean onUseOnBlock(Player player, Player.Hand hand, BlockPosition position, Direction blockFace) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the player click on this item on an inventory
|
||||
* <p>
|
||||
* Executed before any events
|
||||
*
|
||||
* @param player
|
||||
* @param clickType
|
||||
* @param slot
|
||||
* @param playerInventory
|
||||
*/
|
||||
public void onInventoryClick(Player player, ClickType clickType, int slot, boolean playerInventory) {
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user