SPIGOT-6758: Reset ItemSign#openSign when aborting the block placement early

By: blablubbabc <lukas@wirsindwir.de>
This commit is contained in:
CraftBukkit/Spigot 2021-10-16 18:48:22 +11:00
parent 55f4d6c7cb
commit ea404e3d82

View File

@ -103,7 +103,7 @@
EntityHuman entityhuman = itemactioncontext.getEntity(); EntityHuman entityhuman = itemactioncontext.getEntity();
BlockPosition blockposition = itemactioncontext.getClickPosition(); BlockPosition blockposition = itemactioncontext.getClickPosition();
ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getWorld(), blockposition, false); ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getWorld(), blockposition, false);
@@ -202,12 +254,155 @@ @@ -202,12 +254,157 @@
if (entityhuman != null && !entityhuman.getAbilities().mayBuild && !this.b(itemactioncontext.getWorld().r(), shapedetectorblock)) { if (entityhuman != null && !entityhuman.getAbilities().mayBuild && !this.b(itemactioncontext.getWorld().r(), shapedetectorblock)) {
return EnumInteractionResult.PASS; return EnumInteractionResult.PASS;
} else { } else {
@ -155,6 +155,7 @@
+ } + }
+ } + }
+ +
+ ItemSign.openSign = null; // SPIGOT-6758 - Reset on early return
+ return enuminteractionresult; + return enuminteractionresult;
+ } + }
+ world.captureTreeGeneration = false; + world.captureTreeGeneration = false;
@ -186,6 +187,7 @@
+ for (EnumDirection dir : EnumDirection.values()) { + for (EnumDirection dir : EnumDirection.values()) {
+ ((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutBlockChange(world, placedPos.shift(dir))); + ((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutBlockChange(world, placedPos.shift(dir)));
+ } + }
+ ItemSign.openSign = null; // SPIGOT-6758 - Reset on early return
+ } else { + } else {
+ // Change the stack to its new contents if it hasn't been tampered with. + // Change the stack to its new contents if it hasn't been tampered with.
+ if (this.getCount() == oldCount && Objects.equals(this.tag, oldData)) { + if (this.getCount() == oldCount && Objects.equals(this.tag, oldData)) {
@ -260,7 +262,7 @@
return enuminteractionresult; return enuminteractionresult;
} }
@@ -288,6 +483,21 @@ @@ -288,6 +485,21 @@
} }
i -= k; i -= k;
@ -282,7 +284,7 @@
if (i <= 0) { if (i <= 0) {
return false; return false;
} }
@@ -309,6 +519,11 @@ @@ -309,6 +521,11 @@
if (this.isDamaged(i, t0.getRandom(), t0 instanceof EntityPlayer ? (EntityPlayer) t0 : null)) { if (this.isDamaged(i, t0.getRandom(), t0 instanceof EntityPlayer ? (EntityPlayer) t0 : null)) {
consumer.accept(t0); consumer.accept(t0);
Item item = this.getItem(); Item item = this.getItem();
@ -294,7 +296,7 @@
this.subtract(1); this.subtract(1);
if (t0 instanceof EntityHuman) { if (t0 instanceof EntityHuman) {
@@ -464,6 +679,17 @@ @@ -464,6 +681,17 @@
return this.tag; return this.tag;
} }
@ -312,7 +314,7 @@
public NBTTagCompound getOrCreateTag() { public NBTTagCompound getOrCreateTag() {
if (this.tag == null) { if (this.tag == null) {
this.setTag(new NBTTagCompound()); this.setTag(new NBTTagCompound());
@@ -844,6 +1070,12 @@ @@ -844,6 +1072,12 @@
} }
public void setRepairCost(int i) { public void setRepairCost(int i) {
@ -325,7 +327,7 @@
this.getOrCreateTag().setInt("RepairCost", i); this.getOrCreateTag().setInt("RepairCost", i);
} }
@@ -893,6 +1125,13 @@ @@ -893,6 +1127,13 @@
nbttaglist.add(nbttagcompound); nbttaglist.add(nbttagcompound);
} }