13
0
geforkt von Mirrors/Paper

SPIGOT-4734: Sign placement fails when looking at grass

By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2019-04-25 09:55:41 +10:00
Ursprung 455eafa839
Commit e9b89119e0
2 geänderte Dateien mit 16 neuen und 13 gelöschten Zeilen

Datei anzeigen

@ -4,7 +4,7 @@
public class ItemSign extends ItemBlockWallable { public class ItemSign extends ItemBlockWallable {
+ public static boolean openSign; // CraftBukkit + public static BlockPosition openSign; // CraftBukkit
+ +
public ItemSign(Item.Info item_info, Block block, Block block1) { public ItemSign(Item.Info item_info, Block block, Block block1) {
super(block, block1, item_info); super(block, block1, item_info);
@ -16,7 +16,7 @@
- entityhuman.openSign((TileEntitySign) world.getTileEntity(blockposition)); - entityhuman.openSign((TileEntitySign) world.getTileEntity(blockposition));
+ // CraftBukkit start - SPIGOT-4678 + // CraftBukkit start - SPIGOT-4678
+ // entityhuman.openSign((TileEntitySign) world.getTileEntity(blockposition)); + // entityhuman.openSign((TileEntitySign) world.getTileEntity(blockposition));
+ ItemSign.openSign = true; + ItemSign.openSign = blockposition;
+ // CraftBukkit end + // CraftBukkit end
} }

Datei anzeigen

@ -80,7 +80,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);
@@ -104,12 +141,150 @@ @@ -104,12 +141,153 @@
if (entityhuman != null && !entityhuman.abilities.mayBuild && !this.b(itemactioncontext.getWorld().t(), shapedetectorblock)) { if (entityhuman != null && !entityhuman.abilities.mayBuild && !this.b(itemactioncontext.getWorld().t(), shapedetectorblock)) {
return EnumInteractionResult.PASS; return EnumInteractionResult.PASS;
} else { } else {
@ -212,9 +212,12 @@
+ } + }
+ +
+ // SPIGOT-4678 + // SPIGOT-4678
+ if (this.item instanceof ItemSign && ItemSign.openSign) { + if (this.item instanceof ItemSign && ItemSign.openSign != null) {
+ ItemSign.openSign = false; + try {
+ entityhuman.openSign((TileEntitySign) world.getTileEntity(new BlockActionContext(itemactioncontext).getClickPosition())); + entityhuman.openSign((TileEntitySign) world.getTileEntity(ItemSign.openSign));
+ } finally {
+ ItemSign.openSign = null;
+ }
+ } + }
+ +
+ // SPIGOT-1288 - play sound stripped from ItemBlock + // SPIGOT-1288 - play sound stripped from ItemBlock
@ -232,7 +235,7 @@
return enuminteractionresult; return enuminteractionresult;
} }
@@ -133,7 +308,7 @@ @@ -133,7 +311,7 @@
nbttagcompound.setString("id", minecraftkey == null ? "minecraft:air" : minecraftkey.toString()); nbttagcompound.setString("id", minecraftkey == null ? "minecraft:air" : minecraftkey.toString());
nbttagcompound.setByte("Count", (byte) this.count); nbttagcompound.setByte("Count", (byte) this.count);
if (this.tag != null) { if (this.tag != null) {
@ -241,7 +244,7 @@
} }
return nbttagcompound; return nbttagcompound;
@@ -166,6 +341,12 @@ @@ -166,6 +344,12 @@
} }
public void setDamage(int i) { public void setDamage(int i) {
@ -254,7 +257,7 @@
this.getOrCreateTag().setInt("Damage", Math.max(0, i)); this.getOrCreateTag().setInt("Damage", Math.max(0, i));
} }
@@ -190,6 +371,21 @@ @@ -190,6 +374,21 @@
} }
i -= k; i -= k;
@ -276,7 +279,7 @@
if (i <= 0) { if (i <= 0) {
return false; return false;
} }
@@ -211,6 +407,11 @@ @@ -211,6 +410,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();
@ -288,7 +291,7 @@
this.subtract(1); this.subtract(1);
if (t0 instanceof EntityHuman) { if (t0 instanceof EntityHuman) {
@@ -338,6 +539,17 @@ @@ -338,6 +542,17 @@
return this.tag; return this.tag;
} }
@ -306,7 +309,7 @@
public NBTTagCompound getOrCreateTag() { public NBTTagCompound getOrCreateTag() {
if (this.tag == null) { if (this.tag == null) {
this.setTag(new NBTTagCompound()); this.setTag(new NBTTagCompound());
@@ -482,6 +694,12 @@ @@ -482,6 +697,12 @@
} }
public void setRepairCost(int i) { public void setRepairCost(int i) {
@ -319,7 +322,7 @@
this.getOrCreateTag().setInt("RepairCost", i); this.getOrCreateTag().setInt("RepairCost", i);
} }
@@ -524,6 +742,13 @@ @@ -524,6 +745,13 @@
nbttaglist.add(nbttagcompound); nbttaglist.add(nbttagcompound);
} }