From 121dfc098a882c8fb157e8232001ce19c9846ccf Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 30 Jun 2016 15:39:58 +1000 Subject: SPIGOT-1288: Sounds played for cancelled BlockPlaceEvent --- nms-patches/ItemBlock.patch | 11 +++++++++++ nms-patches/ItemStack.patch | 18 ++++++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 nms-patches/ItemBlock.patch diff --git a/nms-patches/ItemBlock.patch b/nms-patches/ItemBlock.patch new file mode 100644 index 00000000..90aa56cb --- /dev/null +++ b/nms-patches/ItemBlock.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/server/ItemBlock.java ++++ b/net/minecraft/server/ItemBlock.java +@@ -36,7 +36,7 @@ + + SoundEffectType soundeffecttype = this.a.w(); + +- world.a(entityhuman, blockposition, soundeffecttype.e(), SoundCategory.BLOCKS, (soundeffecttype.a() + 1.0F) / 2.0F, soundeffecttype.b() * 0.8F); ++ // world.a(entityhuman, blockposition, soundeffecttype.e(), SoundCategory.BLOCKS, (soundeffecttype.a() + 1.0F) / 2.0F, soundeffecttype.b() * 0.8F); // CraftBukkit - SPIGOT-1288 + --itemstack.count; + } + diff --git a/nms-patches/ItemStack.patch b/nms-patches/ItemStack.patch index 4101e906..e6cb7f25 100644 --- a/nms-patches/ItemStack.patch +++ b/nms-patches/ItemStack.patch @@ -44,7 +44,7 @@ } -@@ -81,11 +104,131 @@ +@@ -81,11 +104,137 @@ } public EnumInteractionResult placeItem(EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) { @@ -168,6 +168,12 @@ + } + } + ++ // SPIGOT-1288 - play sound stripped from ItemBlock ++ if (this.getItem() instanceof ItemBlock) { ++ SoundEffectType soundeffecttype = ((ItemBlock) this.getItem()).d().w(); // PAIL: rename ++ world.a(entityhuman, blockposition, soundeffecttype.e(), SoundCategory.BLOCKS, (soundeffecttype.a() + 1.0F) / 2.0F, soundeffecttype.b() * 0.8F); ++ } ++ + entityhuman.b(StatisticList.b(this.item)); + } } @@ -177,7 +183,7 @@ return enuminteractionresult; } -@@ -110,7 +253,7 @@ +@@ -110,7 +259,7 @@ nbttagcompound.setByte("Count", (byte) this.count); nbttagcompound.setShort("Damage", (short) this.damage); if (this.tag != null) { @@ -186,7 +192,7 @@ } return nbttagcompound; -@@ -119,13 +262,18 @@ +@@ -119,13 +268,18 @@ public void c(NBTTagCompound nbttagcompound) { this.item = Item.d(nbttagcompound.getString("id")); this.count = nbttagcompound.getByte("Count"); @@ -206,7 +212,7 @@ if (this.item != null) { this.item.a(this.tag); } -@@ -162,11 +310,30 @@ +@@ -162,11 +316,30 @@ } public void setData(int i) { @@ -239,7 +245,7 @@ } public int j() { -@@ -214,6 +381,12 @@ +@@ -214,6 +387,12 @@ this.count = 0; } @@ -252,7 +258,7 @@ this.damage = 0; } -@@ -514,6 +687,7 @@ +@@ -514,6 +693,7 @@ @Deprecated public void setItem(Item item) { this.item = item; -- cgit v1.2.3