SPIGOT-1288: Sounds played for cancelled BlockPlaceEvent

This commit is contained in:
md_5 2016-06-30 15:39:58 +10:00
parent 6b843d995f
commit 121dfc098a
2 changed files with 23 additions and 6 deletions

View File

@ -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;
}

View File

@ -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) { 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)); + entityhuman.b(StatisticList.b(this.item));
+ } + }
} }
@ -177,7 +183,7 @@
return enuminteractionresult; return enuminteractionresult;
} }
@@ -110,7 +253,7 @@ @@ -110,7 +259,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) {
@ -186,7 +192,7 @@
} }
return nbttagcompound; return nbttagcompound;
@@ -119,13 +262,18 @@ @@ -119,13 +268,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");
@ -206,7 +212,7 @@
if (this.item != null) { if (this.item != null) {
this.item.a(this.tag); this.item.a(this.tag);
} }
@@ -162,11 +310,30 @@ @@ -162,11 +316,30 @@
} }
public void setData(int i) { public void setData(int i) {
@ -239,7 +245,7 @@
} }
public int j() { public int j() {
@@ -214,6 +381,12 @@ @@ -214,6 +387,12 @@
this.count = 0; this.count = 0;
} }
@ -252,7 +258,7 @@
this.damage = 0; this.damage = 0;
} }
@@ -514,6 +687,7 @@ @@ -514,6 +693,7 @@
@Deprecated @Deprecated
public void setItem(Item item) { public void setItem(Item item) {
this.item = item; this.item = item;