Class PlayerDestroyItemEvent


public class PlayerDestroyItemEvent extends PlayerEvent
PlayerDestroyItemEvent is fired when a player destroys an item.
This event is fired whenever a player destroys an item in PlayerController#onPlayerDestroyBlock(BlockPos), PlayerController#processRightClick(PlayerEntity, World, Hand), PlayerController#processRightClickBlock(ClientPlayerEntity, ClientWorld, BlockPos, Direction, Vec3d, Hand), PlayerEntity#attackTargetEntityWithCurrentItem(Entity), PlayerEntity#damageShield(float), PlayerEntity.interactOn(Entity, Hand), ForgeHooks.getContainerItem(ItemStack), PlayerInteractionManager#processRightClick(PlayerEntity, World, ItemStack, Hand), PlayerInteractionManager#processRightClickBlock(PlayerEntity, World, ItemStack, Hand, BlockPos, Direction, float, float, float) and PlayerInteractionManager#tryHarvestBlock(BlockPos).

original contains the original ItemStack before the item was destroyed.
(@link #hand) contains the hand that the current item was held in.

This event is not Cancelable.

This event does not have a result. Event.HasResult

This event is fired from ForgeEventFactory.onPlayerDestroyItem(PlayerEntity, ItemStack, Hand).
This event is fired on the MinecraftForge.EVENT_BUS.
  • Field Details

    • original

      @Nonnull private final ItemStack original
    • hand

      @Nullable private final Hand hand
  • Constructor Details

    • PlayerDestroyItemEvent

      public PlayerDestroyItemEvent(PlayerEntity player, @Nonnull ItemStack original, @Nullable Hand hand)
  • Method Details

    • getOriginal

      @Nonnull public ItemStack getOriginal()
    • getHand

      @Nullable public Hand getHand()