类 LivingSwapItemsEvent.Hands

封闭类:
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.

  • 字段详细资料

  • 构造器详细资料

  • 方法详细资料

    • getItemSwappedToMainHand

      public ItemStack getItemSwappedToMainHand()
      Gets the item that will be swapped to the main hand of the entity.
      返回:
      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.
      返回:
      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.
      参数:
      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.
      参数:
      item - The item to swap to the offhand.