Fix item used stat not triggering properly on last item in the stack.

This commit is contained in:
LexManos 2019-09-03 19:58:57 -07:00
parent 2c8c022034
commit 4dc34b7d5b

View file

@ -589,17 +589,14 @@ public class ForgeHooks
return ActionResultType.PASS;
// handle all placement events here
Item item = itemstack.getItem();
int size = itemstack.getCount();
CompoundNBT nbt = null;
if (itemstack.getTag() != null)
{
nbt = itemstack.getTag().copy();
}
if (!(itemstack.getItem() instanceof BucketItem)) // if not bucket
{
world.captureBlockSnapshots = true;
}
ItemStack copy = itemstack.isDamageable() ? itemstack.copy() : null;
ActionResultType ret = itemstack.getItem().onItemUse(context);
@ -666,7 +663,7 @@ public class ForgeHooks
world.markAndNotifyBlock(snap.getPos(), null, oldBlock, newBlock, updateFlag);
}
player.addStat(Stats.ITEM_USED.get(itemstack.getItem()));
player.addStat(Stats.ITEM_USED.get(item));
}
}
world.capturedBlockSnapshots.clear();