mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 18:45:54 +01:00
SPIGOT-4734: Sign placement fails when looking at grass
This commit is contained in:
parent
de6cdd0364
commit
c124606439
@ -4,7 +4,7 @@
|
||||
|
||||
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) {
|
||||
super(block, block1, item_info);
|
||||
@ -16,7 +16,7 @@
|
||||
- entityhuman.openSign((TileEntitySign) world.getTileEntity(blockposition));
|
||||
+ // CraftBukkit start - SPIGOT-4678
|
||||
+ // entityhuman.openSign((TileEntitySign) world.getTileEntity(blockposition));
|
||||
+ ItemSign.openSign = true;
|
||||
+ ItemSign.openSign = blockposition;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@
|
||||
EntityHuman entityhuman = itemactioncontext.getEntity();
|
||||
BlockPosition blockposition = itemactioncontext.getClickPosition();
|
||||
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)) {
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
@ -212,9 +212,12 @@
|
||||
+ }
|
||||
+
|
||||
+ // SPIGOT-4678
|
||||
+ if (this.item instanceof ItemSign && ItemSign.openSign) {
|
||||
+ ItemSign.openSign = false;
|
||||
+ entityhuman.openSign((TileEntitySign) world.getTileEntity(new BlockActionContext(itemactioncontext).getClickPosition()));
|
||||
+ if (this.item instanceof ItemSign && ItemSign.openSign != null) {
|
||||
+ try {
|
||||
+ entityhuman.openSign((TileEntitySign) world.getTileEntity(ItemSign.openSign));
|
||||
+ } finally {
|
||||
+ ItemSign.openSign = null;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // SPIGOT-1288 - play sound stripped from ItemBlock
|
||||
@ -232,7 +235,7 @@
|
||||
|
||||
return enuminteractionresult;
|
||||
}
|
||||
@@ -133,7 +308,7 @@
|
||||
@@ -133,7 +311,7 @@
|
||||
nbttagcompound.setString("id", minecraftkey == null ? "minecraft:air" : minecraftkey.toString());
|
||||
nbttagcompound.setByte("Count", (byte) this.count);
|
||||
if (this.tag != null) {
|
||||
@ -241,7 +244,7 @@
|
||||
}
|
||||
|
||||
return nbttagcompound;
|
||||
@@ -166,6 +341,12 @@
|
||||
@@ -166,6 +344,12 @@
|
||||
}
|
||||
|
||||
public void setDamage(int i) {
|
||||
@ -254,7 +257,7 @@
|
||||
this.getOrCreateTag().setInt("Damage", Math.max(0, i));
|
||||
}
|
||||
|
||||
@@ -190,6 +371,21 @@
|
||||
@@ -190,6 +374,21 @@
|
||||
}
|
||||
|
||||
i -= k;
|
||||
@ -276,7 +279,7 @@
|
||||
if (i <= 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -211,6 +407,11 @@
|
||||
@@ -211,6 +410,11 @@
|
||||
if (this.isDamaged(i, t0.getRandom(), t0 instanceof EntityPlayer ? (EntityPlayer) t0 : null)) {
|
||||
consumer.accept(t0);
|
||||
Item item = this.getItem();
|
||||
@ -288,7 +291,7 @@
|
||||
|
||||
this.subtract(1);
|
||||
if (t0 instanceof EntityHuman) {
|
||||
@@ -338,6 +539,17 @@
|
||||
@@ -338,6 +542,17 @@
|
||||
return this.tag;
|
||||
}
|
||||
|
||||
@ -306,7 +309,7 @@
|
||||
public NBTTagCompound getOrCreateTag() {
|
||||
if (this.tag == null) {
|
||||
this.setTag(new NBTTagCompound());
|
||||
@@ -482,6 +694,12 @@
|
||||
@@ -482,6 +697,12 @@
|
||||
}
|
||||
|
||||
public void setRepairCost(int i) {
|
||||
@ -319,7 +322,7 @@
|
||||
this.getOrCreateTag().setInt("RepairCost", i);
|
||||
}
|
||||
|
||||
@@ -524,6 +742,13 @@
|
||||
@@ -524,6 +745,13 @@
|
||||
nbttaglist.add(nbttagcompound);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user