SPIGOT-7236: Bone meal doesn't increase use statistic

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2023-01-21 11:00:43 +11:00
parent 2923c2979f
commit a7effc38ed

View file

@ -95,7 +95,7 @@
EntityHuman entityhuman = itemactioncontext.getPlayer();
BlockPosition blockposition = itemactioncontext.getClickedPos();
ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getLevel(), blockposition, false);
@@ -232,12 +285,157 @@
@@ -232,12 +285,158 @@
if (entityhuman != null && !entityhuman.getAbilities().mayBuild && !this.hasAdventureModePlaceTagForBlock(itemactioncontext.getLevel().registryAccess().registryOrThrow(Registries.BLOCK), shapedetectorblock)) {
return EnumInteractionResult.PASS;
} else {
@ -145,6 +145,7 @@
+ for (BlockState blockstate : blocks) {
+ blockstate.update(true);
+ }
+ entityhuman.awardStat(StatisticList.ITEM_USED.get(item)); // SPIGOT-7236 - award stat
+ }
+
+ ItemSign.openSign = null; // SPIGOT-6758 - Reset on early return
@ -254,7 +255,7 @@
return enuminteractionresult;
}
@@ -318,6 +516,21 @@
@@ -318,6 +517,21 @@
}
i -= k;
@ -276,7 +277,7 @@
if (i <= 0) {
return false;
}
@@ -339,6 +552,11 @@
@@ -339,6 +553,11 @@
if (this.hurt(i, t0.getRandom(), t0 instanceof EntityPlayer ? (EntityPlayer) t0 : null)) {
consumer.accept(t0);
Item item = this.getItem();
@ -288,7 +289,7 @@
this.shrink(1);
if (t0 instanceof EntityHuman) {
@@ -493,6 +711,17 @@
@@ -493,6 +712,17 @@
return this.tag;
}
@ -306,7 +307,7 @@
public NBTTagCompound getOrCreateTag() {
if (this.tag == null) {
this.setTag(new NBTTagCompound());
@@ -859,6 +1088,12 @@
@@ -859,6 +1089,12 @@
}
public void setRepairCost(int i) {
@ -319,7 +320,7 @@
this.getOrCreateTag().putInt("RepairCost", i);
}
@@ -908,6 +1143,13 @@
@@ -908,6 +1144,13 @@
nbttaglist.add(nbttagcompound);
}