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(net.minecraft.network.protocol.game.ServerboundPlayerActionPacket)
This event is cancellable, and does not have a result.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.living.LivingSwapItemsEvent
LivingSwapItemsEvent.Hands
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.living.LivingEvent
LivingEvent.LivingJumpEvent, LivingEvent.LivingTickEvent, LivingEvent.LivingVisibilityEvent
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size
Nested classes/interfaces inherited from class net.neoforged.bus.api.Event
net.neoforged.bus.api.Event.HasResult, net.neoforged.bus.api.Event.Result
-
Field Summary
-
Constructor Summary
-
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.void
Sets the item that will be swapped to the main hand of the entity.void
Sets the item that will be swapped to the offhand of the entity.Methods inherited from class net.neoforged.neoforge.event.entity.living.LivingEvent
getEntity
Methods inherited from class net.neoforged.bus.api.Event
getResult, hasResult, setResult
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
-
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.
-