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
.invalid reference
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.LivingVisibilityEvent
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate net.minecraft.world.item.ItemStack
private net.minecraft.world.item.ItemStack
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.item.ItemStack
Gets the item that will be swapped to the main hand of the entity.net.minecraft.world.item.ItemStack
Gets the item that will be swapped to the offhand of the entity.void
setItemSwappedToMainHand
(net.minecraft.world.item.ItemStack item) Sets the item that will be swapped to the main hand of the entity.void
setItemSwappedToOffHand
(net.minecraft.world.item.ItemStack item) 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 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
private net.minecraft.world.item.ItemStack toMainHand -
toOffHand
private net.minecraft.world.item.ItemStack toOffHand
-
-
Constructor Details
-
Hands
@Internal public Hands(net.minecraft.world.entity.LivingEntity entity)
-
-
Method Details
-
getItemSwappedToMainHand
public net.minecraft.world.item.ItemStack 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
public net.minecraft.world.item.ItemStack 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
public void setItemSwappedToMainHand(net.minecraft.world.item.ItemStack item) 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
public void setItemSwappedToOffHand(net.minecraft.world.item.ItemStack item) Sets the item that will be swapped to the offhand of the entity.- Parameters:
item
- The item to swap to the offhand.
-