Class LivingSwapItemsEvent.Hands
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.EntityEvent
net.neoforged.neoforge.event.entity.living.LivingEvent
net.neoforged.neoforge.event.entity.living.LivingSwapItemsEvent
net.neoforged.neoforge.event.entity.living.LivingSwapItemsEvent.Hands
- All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent
- Enclosing class:
LivingSwapItemsEvent
public static class LivingSwapItemsEvent.Hands
extends LivingSwapItemsEvent
implements net.neoforged.bus.api.ICancellableEvent
This event is fired when a living entity is about to swap the items in their main and offhand.
This event is executed in
ServerGamePacketListenerImpl.handlePlayerAction(ServerboundPlayerActionPacket)
This event is cancellable, and does not
.invalid reference
have a result
-
Nested Class Summary
Nested classes/interfaces inherited from class LivingSwapItemsEvent
LivingSwapItemsEvent.HandsNested classes/interfaces inherited from class LivingEvent
LivingEvent.LivingJumpEvent, LivingEvent.LivingVisibilityEventNested classes/interfaces inherited from class EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the item that will be swapped to the main hand of the entity.Gets the item that will be swapped to the offhand of the entity.voidSets the item that will be swapped to the main hand of the entity.voidSets the item that will be swapped to the offhand of the entity.Methods inherited from class LivingEvent
getEntityMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.neoforged.bus.api.ICancellableEvent
isCanceled, setCanceled
-
Field Details
-
toMainHand
-
toOffHand
-
-
Constructor Details
-
Hands
-
-
Method Details
-
getItemSwappedToMainHand
Gets the item that will be swapped to the main hand of the entity.- Returns:
- The item that will be swapped to the main hand.
-
getItemSwappedToOffHand
Gets the item that will be swapped to the offhand of the entity.- Returns:
- The item that will be swapped to the offhand.
-
setItemSwappedToMainHand
Sets the item that will be swapped to the main hand of the entity.- Parameters:
item- The item to swap to the main hand.
-
setItemSwappedToOffHand
Sets the item that will be swapped to the offhand of the entity.- Parameters:
item- The item to swap to the offhand.
-