Class LivingSwapItemsEvent.Hands

Enclosing class:
LivingSwapItemsEvent

public static class LivingSwapItemsEvent.Hands extends LivingSwapItemsEvent
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.

  • Field Details

  • Constructor Details

  • Method Details

    • getItemSwappedToMainHand

      public 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 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(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(ItemStack item)
      Sets the item that will be swapped to the offhand of the entity.
      Parameters:
      item - The item to swap to the offhand.