Package net.neoforged.neoforge.event
Class ItemStackedOnOtherEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.ItemStackedOnOtherEvent
- All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent
public class ItemStackedOnOtherEvent
extends net.neoforged.bus.api.Event
implements net.neoforged.bus.api.ICancellableEvent
This event provides the functionality of the pair of functions used for the Bundle, in one event:
Item.overrideOtherStackedOnMe(ItemStack, ItemStack, Slot, ClickAction, Player, SlotAccess)
Item.overrideStackedOnOther(ItemStack, Slot, ClickAction, Player)
This event is cancellable, and does not
.
If the event is cancelled, the container's logic halts, the carried item and the slot will not be swapped, and handling is assumed to have been done by the mod.
This also means that the two vanilla checks described above will not be called.invalid reference
have a result
-
Field Summary
Modifier and TypeFieldDescriptionprivate final ClickAction
private final ItemStack
private final SlotAccess
private final Player
private final Slot
private final ItemStack
-
Constructor Summary
ConstructorDescriptionItemStackedOnOtherEvent
(ItemStack carriedItem, ItemStack stackedOnItem, Slot slot, ClickAction action, Player player, SlotAccess carriedSlotAccess) -
Method Summary
Modifier and TypeMethodDescriptionReturns the stack being carried by the mouse.Returns a fake slot allowing the listener to see and change what item is being carried.Returns the click action being used.Returns the player doing the item swap attempt.getSlot()
Returns the slot being clicked on.Returns the stack currently in the slot being clicked on.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.neoforged.bus.api.ICancellableEvent
isCanceled, setCanceled
-
Field Details
-
carriedItem
-
stackedOnItem
-
slot
-
action
-
player
-
carriedSlotAccess
-
-
Constructor Details
-
ItemStackedOnOtherEvent
@Internal public ItemStackedOnOtherEvent(ItemStack carriedItem, ItemStack stackedOnItem, Slot slot, ClickAction action, Player player, SlotAccess carriedSlotAccess)
-
-
Method Details
-
getCarriedItem
Returns the stack being carried by the mouse. This may be empty!- Returns:
- the stack being carried by the mouse
-
getStackedOnItem
Returns the stack currently in the slot being clicked on. This may be empty!- Returns:
- the stack currently in the slot being clicked on
-
getSlot
Returns the slot being clicked on.- Returns:
- the slot being clicked on
-
getClickAction
Returns the click action being used. By default ClickAction.PRIMARY corresponds to left-click, and ClickAction.SECONDARY is right-click.- Returns:
- the click action being used
-
getPlayer
Returns the player doing the item swap attempt.- Returns:
- the player doing the item swap attempt
-
getCarriedSlotAccess
Returns a fake slot allowing the listener to see and change what item is being carried.- Returns:
- a fake slot allowing the listener to see and change what item is being carried
-