mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 06:50:12 +01:00
SPIGOT-4678: Fix placing signs in certain circumstances
This commit is contained in:
parent
d65a2576e4
commit
51100db821
2 changed files with 36 additions and 7 deletions
23
nms-patches/ItemSign.patch
Normal file
23
nms-patches/ItemSign.patch
Normal file
|
@ -0,0 +1,23 @@
|
|||
--- a/net/minecraft/server/ItemSign.java
|
||||
+++ b/net/minecraft/server/ItemSign.java
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
public class ItemSign extends ItemBlockWallable {
|
||||
|
||||
+ public static boolean openSign; // CraftBukkit
|
||||
+
|
||||
public ItemSign(Item.Info item_info) {
|
||||
super(Blocks.SIGN, Blocks.WALL_SIGN, item_info);
|
||||
}
|
||||
@@ -12,7 +14,10 @@
|
||||
boolean flag = super.a(blockposition, world, entityhuman, itemstack, iblockdata);
|
||||
|
||||
if (!world.isClientSide && !flag && entityhuman != null) {
|
||||
- entityhuman.openSign((TileEntitySign) world.getTileEntity(blockposition));
|
||||
+ // CraftBukkit start - SPIGOT-4678
|
||||
+ // entityhuman.openSign((TileEntitySign) world.getTileEntity(blockposition));
|
||||
+ ItemSign.openSign = true;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
return flag;
|
|
@ -87,7 +87,7 @@
|
|||
EntityHuman entityhuman = itemactioncontext.getEntity();
|
||||
BlockPosition blockposition = itemactioncontext.getClickPosition();
|
||||
ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getWorld(), blockposition, false);
|
||||
@@ -105,12 +147,144 @@
|
||||
@@ -105,12 +147,150 @@
|
||||
if (entityhuman != null && !entityhuman.abilities.mayBuild && !this.b(itemactioncontext.getWorld().F(), shapedetectorblock)) {
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
|
@ -218,6 +218,12 @@
|
|||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // SPIGOT-4678
|
||||
+ if (this.item instanceof ItemSign && ItemSign.openSign) {
|
||||
+ ItemSign.openSign = false;
|
||||
+ entityhuman.openSign((TileEntitySign) world.getTileEntity(new BlockActionContext(itemactioncontext).getClickPosition()));
|
||||
+ }
|
||||
+
|
||||
+ // SPIGOT-1288 - play sound stripped from ItemBlock
|
||||
+ if (this.item instanceof ItemBlock) {
|
||||
+ SoundEffectType soundeffecttype = ((ItemBlock) this.item).getBlock().getStepSound();
|
||||
|
@ -233,7 +239,7 @@
|
|||
|
||||
return enuminteractionresult;
|
||||
}
|
||||
@@ -134,7 +308,7 @@
|
||||
@@ -134,7 +314,7 @@
|
||||
nbttagcompound.setString("id", minecraftkey == null ? "minecraft:air" : minecraftkey.toString());
|
||||
nbttagcompound.setByte("Count", (byte) this.count);
|
||||
if (this.tag != null) {
|
||||
|
@ -242,7 +248,7 @@
|
|||
}
|
||||
|
||||
return nbttagcompound;
|
||||
@@ -191,6 +365,21 @@
|
||||
@@ -191,6 +371,21 @@
|
||||
}
|
||||
|
||||
i -= k;
|
||||
|
@ -264,7 +270,7 @@
|
|||
if (i <= 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -212,6 +401,11 @@
|
||||
@@ -212,6 +407,11 @@
|
||||
if (this.isDamaged(i, entityliving.getRandom(), entityliving instanceof EntityPlayer ? (EntityPlayer) entityliving : null)) {
|
||||
entityliving.c(this);
|
||||
Item item = this.getItem();
|
||||
|
@ -276,7 +282,7 @@
|
|||
|
||||
this.subtract(1);
|
||||
if (entityliving instanceof EntityHuman) {
|
||||
@@ -335,6 +529,17 @@
|
||||
@@ -335,6 +535,17 @@
|
||||
return this.tag;
|
||||
}
|
||||
|
||||
|
@ -294,7 +300,7 @@
|
|||
public NBTTagCompound getOrCreateTag() {
|
||||
if (this.tag == null) {
|
||||
this.setTag(new NBTTagCompound());
|
||||
@@ -479,6 +684,14 @@
|
||||
@@ -479,6 +690,14 @@
|
||||
}
|
||||
|
||||
public void setRepairCost(int i) {
|
||||
|
@ -309,7 +315,7 @@
|
|||
this.getOrCreateTag().setInt("RepairCost", i);
|
||||
}
|
||||
|
||||
@@ -521,6 +734,13 @@
|
||||
@@ -521,6 +740,13 @@
|
||||
nbttaglist.add((NBTBase) nbttagcompound);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue