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
invalid reference
MultiPlayerGameMode#destroyBlock(BlockPos)
,
invalid reference
MultiPlayerGameMode#useItem(Player, InteractionHand)
,
invalid reference
MultiPlayerGameMode#useItemOn(LocalPlayer, InteractionHand, BlockHitResult)
, Player.attack(Entity), Player#hurtCurrentlyUsedShield(float), Player.interactOn(Entity, InteractionHand), CommonHooks.getCraftingRemainder(ItemStack), ServerPlayerGameMode.useItem(ServerPlayer, Level, ItemStack, InteractionHand) , ServerPlayerGameMode.useItemOn(ServerPlayer, Level, ItemStack, InteractionHand, BlockHitResult) and ServerPlayerGameMode.destroyBlock(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
invalid reference
ICancellableEvent
.

This event does not have a result.
invalid reference
HasResult


This event is fired from EventHooks.onPlayerDestroyItem(Player, ItemStack, InteractionHand).
This event is fired on the NeoForge.EVENT_BUS.
  • Field Details

    • original

      private final net.minecraft.world.item.ItemStack original
    • hand

      @Nullable private final @Nullable net.minecraft.world.InteractionHand hand
  • Constructor Details

    • PlayerDestroyItemEvent

      public PlayerDestroyItemEvent(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack original, @Nullable @Nullable net.minecraft.world.InteractionHand hand)
  • Method Details

    • getOriginal

      public net.minecraft.world.item.ItemStack getOriginal()
    • getHand

      @Nullable public @Nullable net.minecraft.world.InteractionHand getHand()