Fix issue with providing a null ItemStack to onPlayerDestroyItem (#6633)

This commit is contained in:
Jacob Smith 2020-05-03 13:48:17 -07:00 committed by GitHub
parent 9e763a8334
commit c3e4d303e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -606,7 +606,7 @@ public class ForgeHooks
if (!(itemstack.getItem() instanceof BucketItem)) // if not bucket if (!(itemstack.getItem() instanceof BucketItem)) // if not bucket
world.captureBlockSnapshots = true; world.captureBlockSnapshots = true;
ItemStack copy = itemstack.isDamageable() ? itemstack.copy() : null; ItemStack copy = itemstack.copy();
ActionResultType ret = itemstack.getItem().onItemUse(context); ActionResultType ret = itemstack.getItem().onItemUse(context);
if (itemstack.isEmpty()) if (itemstack.isEmpty())
ForgeEventFactory.onPlayerDestroyItem(player, copy, context.getHand()); ForgeEventFactory.onPlayerDestroyItem(player, copy, context.getHand());