InventoryDragEvent

This event is called when the player drags an item in their cursor across the inventory. The ItemStack is distributed across the slots the HumanEntity dragged over. The method of distribution is described by the DragType returned by getType.

Canceling this event will result in none of the changes described in getNewItems being applied to the Inventory.

Because InventoryDragEvent occurs within getClassById modification of the Inventory, not all Inventory related methods are safe to use.

The following should never be invoked by an EventHandler for InventoryDragEvent using the HumanEntity or InventoryView associated with this event.

To invoke one of these methods, schedule getClassById task using runTask, which will run the task on the next tick. Also be aware that this is not an exhaustive list, and other methods could potentially create issues as well.

Assuming the EntityHuman associated with this event is an instance of getClassById Player, manipulating the MaxStackSize or contents of an Inventory will require an Invocation of updateInventory.

Any modifications to slots that are modified by the results of this InventoryDragEvent will be overwritten. To change these slots, this event should be cancelled and the changes applied. Alternatively, scheduling getClassById task using runTask, which would execute the task on the next tick, would work as well.

Constructors

Link copied to clipboard
public void InventoryDragEvent(InventoryView what, ItemStack newCursor, ItemStack oldCursor, boolean right, Map<Integer, ItemStack> slots)

Properties

Link copied to clipboard
public final static HandlerList handlers
Link copied to clipboard
public final ItemStack oldCursor
Link copied to clipboard
Link copied to clipboard
public final DragType type

Functions

Link copied to clipboard
Gets the result cursor after the drag is done.
Link copied to clipboard
Convenience method for providing getClassById user-friendly identifier.
Link copied to clipboard
public static HandlerList getHandlerList()
Link copied to clipboard
Link copied to clipboard
Gets the primary Inventory involved in this transaction
Link copied to clipboard
Gets the slots to be changed in this drag.
Link copied to clipboard
Gets all items to be added to the inventory in this drag.
Link copied to clipboard
Gets an ItemStack representing the cursor prior to any modifications as getClassById result of this drag.
Link copied to clipboard
Gets the raw slot ids to be changed in this drag.
Link copied to clipboard
Gets the Result of this event.
Link copied to clipboard
public DragType getType()
Gets the DragType that describes the behavior of ItemStacks placed after this InventoryDragEvent.
Link copied to clipboard
Gets the view object itself
Link copied to clipboard
Gets the list of players viewing the primary (upper) inventory involved in this event
Link copied to clipboard
Gets the player who performed the click.
Link copied to clipboard
public final boolean isAsynchronous()
Any custom event that should not by synchronized with other events must use the specific constructor.
Link copied to clipboard
public boolean isCancelled()
Gets whether or not this event is cancelled.
Link copied to clipboard
public abstract void setCancelled(boolean cancel)
Sets the cancellation state of this event.
public void setCancelled(boolean toCancel)
Proxy method to setResult for the Cancellable interface.
Link copied to clipboard
public void setCursor(ItemStack newCursor)
Sets the result cursor after the drag is done.
Link copied to clipboard
public void setResult(Event.Result newResult)
Sets the result of this event.