Improve chest sound handling patch

This commit is contained in:
Zach Brown 2014-12-07 14:52:19 -06:00
parent 275af1a769
commit 535076aa8b

View File

@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public float j; // PaperSpigot - lidAngle
public float k;
- public int l;
+ public int l; // PaperSpigot - playersUsing
+ public int l; // PaperSpigot - numPlayersUsing
private int n;
private int o = -1;
private String p;
@ -54,7 +54,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.world == null) return; // CraftBukkit
+
+ // PaperSpigot - Move chest open sound out of the tick loop
+ if (this.l > 1 && this.j == 0.0F && this.f == null && this.h == null) {
+ this.m();
+
+ if (this.l > 0 && this.j == 0.0F && this.f == null && this.h == null) {
+ this.j = 0.7F;
+
+ int locX = this.position.getX();
+ int locY = this.position.getY();
+ int locZ = this.position.getZ();
@ -109,9 +113,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ this.world.makeSound(d0, (double) locY + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+
+ if (this.j < 0.0F) {
+ this.j = 0.0F;
+ }
+ this.j = 0.0F;
+ }
+ // PaperSpigot end
+
@ -157,6 +159,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ // PaperSpigot start - Move enderchest open sounds out of the tick loop
+ if (this.g > 0 && this.a == 0.0F) {
+ this.a = 0.7F;
+
+ int locX = this.position.getX();
+ int locY = this.position.getY();
+ int locZ = this.position.getZ();
@ -165,8 +169,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ double d0 = (double) locZ + 0.5D;
+
+ this.world.makeSound(d1, (double) locY + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+
+ this.a = 0.7F;
+ }
+ // PaperSpigot end
+
@ -182,31 +184,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ int locY = this.position.getY();
+ int locZ = this.position.getZ();
+
+ float f = 0.1F;
+ double d0 = (double) locX + 0.5D;
+ double d2 = (double) locZ + 0.5D;
+
+ if (this.g > 0) {
+ this.a += f;
+ } else {
+ this.a -= f;
+ }
+ this.world.makeSound(d0, (double) locY + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+
+ if (this.a > 1.0F) {
+ this.a = 1.0F;
+ }
+
+ float f1 = this.a;
+ float f2 = 0.5F;
+
+ if (this.a < f2 && f1 >= f2) {
+ double d0 = (double) locX + 0.5D;
+ double d2 = (double) locZ + 0.5D;
+
+ this.world.makeSound(d0, (double) locY + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ }
+
+ if (this.a < 0.0F) {
+ this.a = 0.0F;
+ }
+ this.a = 0.0F;
+ }
+ // PaperSpigot end
+