Package net.minecraftforge.event
Class ItemStackedOnOtherEvent
java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.ItemStackedOnOtherEvent
public class ItemStackedOnOtherEvent
extends net.minecraftforge.eventbus.api.Event
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 have a result. 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.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.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 net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
-
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
-