geforkt von Mirrors/Paper
SPIGOT-1749 / MC-99075: Call updateInventory as a temporary workaround for cancelled BlockPlaceEvent
Dieser Commit ist enthalten in:
Ursprung
92494d7dba
Commit
50b4cb8e72
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,11 +101,129 @@
|
@@ -84,11 +101,131 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnumInteractionResult placeItem(EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) {
|
public EnumInteractionResult placeItem(EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) {
|
||||||
@ -104,6 +104,8 @@
|
|||||||
+
|
+
|
||||||
+ if (placeEvent != null && (placeEvent.isCancelled() || !placeEvent.canBuild())) {
|
+ if (placeEvent != null && (placeEvent.isCancelled() || !placeEvent.canBuild())) {
|
||||||
+ enuminteractionresult = EnumInteractionResult.FAIL; // cancel placement
|
+ enuminteractionresult = EnumInteractionResult.FAIL; // cancel placement
|
||||||
|
+ // PAIL: Remove this when MC-99075 fixed
|
||||||
|
+ placeEvent.getPlayer().updateInventory();
|
||||||
+ // revert back all captured blocks
|
+ // revert back all captured blocks
|
||||||
+ for (BlockState blockstate : blocks) {
|
+ for (BlockState blockstate : blocks) {
|
||||||
+ blockstate.update(true, false);
|
+ blockstate.update(true, false);
|
||||||
@ -170,7 +172,7 @@
|
|||||||
|
|
||||||
return enuminteractionresult;
|
return enuminteractionresult;
|
||||||
}
|
}
|
||||||
@@ -112,7 +247,7 @@
|
@@ -112,7 +249,7 @@
|
||||||
nbttagcompound.setByte("Count", (byte) this.count);
|
nbttagcompound.setByte("Count", (byte) this.count);
|
||||||
nbttagcompound.setShort("Damage", (short) this.damage);
|
nbttagcompound.setShort("Damage", (short) this.damage);
|
||||||
if (this.tag != null) {
|
if (this.tag != null) {
|
||||||
@ -179,7 +181,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
return nbttagcompound;
|
return nbttagcompound;
|
||||||
@@ -121,13 +256,18 @@
|
@@ -121,13 +258,18 @@
|
||||||
public void c(NBTTagCompound nbttagcompound) {
|
public void c(NBTTagCompound nbttagcompound) {
|
||||||
this.item = Item.d(nbttagcompound.getString("id"));
|
this.item = Item.d(nbttagcompound.getString("id"));
|
||||||
this.count = nbttagcompound.getByte("Count");
|
this.count = nbttagcompound.getByte("Count");
|
||||||
@ -199,7 +201,7 @@
|
|||||||
if (this.item != null) {
|
if (this.item != null) {
|
||||||
this.item.a(this.tag);
|
this.item.a(this.tag);
|
||||||
}
|
}
|
||||||
@@ -164,9 +304,29 @@
|
@@ -164,9 +306,29 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setData(int i) {
|
public void setData(int i) {
|
||||||
@ -230,7 +232,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -216,6 +376,12 @@
|
@@ -216,6 +378,12 @@
|
||||||
this.count = 0;
|
this.count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +245,7 @@
|
|||||||
this.damage = 0;
|
this.damage = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,6 +679,7 @@
|
@@ -513,6 +681,7 @@
|
||||||
|
|
||||||
public void setItem(Item item) {
|
public void setItem(Item item) {
|
||||||
this.item = item;
|
this.item = item;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren