Fix chest sound playing at the wrong locaton

Closes GH-48
This commit is contained in:
Zach Brown 2016-03-04 17:38:51 -06:00
parent 4076ee569b
commit 43091edd3a
2 changed files with 10 additions and 8 deletions

View file

@ -1,11 +1,11 @@
From e240cad9f99160a8e690e0b7bc1f32b8557ea6d1 Mon Sep 17 00:00:00 2001 From 3813aa00f37de429ecf9ce36d58c67d658de18fb Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 1 Mar 2016 22:01:19 -0600 Date: Tue, 1 Mar 2016 22:01:19 -0600
Subject: [PATCH] Optimize TileEntity Ticking Subject: [PATCH] Optimize TileEntity Ticking
diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java
index 8f988c3..e7829c5 100644 index 8f988c3..4b510b9 100644
--- a/src/main/java/net/minecraft/server/TileEntityChest.java --- a/src/main/java/net/minecraft/server/TileEntityChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityChest.java +++ b/src/main/java/net/minecraft/server/TileEntityChest.java
@@ -8,17 +8,17 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity; @@ -8,17 +8,17 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity;
@ -52,7 +52,7 @@ index 8f988c3..e7829c5 100644
} }
public boolean c(int i, int j) { public boolean c(int i, int j) {
@@ -331,6 +334,28 @@ public class TileEntityChest extends TileEntityLootable implements ITickable, II @@ -331,6 +334,29 @@ public class TileEntityChest extends TileEntityLootable implements ITickable, II
int oldPower = Math.max(0, Math.min(15, this.l)); // CraftBukkit - Get power before new viewer is added int oldPower = Math.max(0, Math.min(15, this.l)); // CraftBukkit - Get power before new viewer is added
++this.l; ++this.l;
@ -65,6 +65,7 @@ index 8f988c3..e7829c5 100644
+ +
+ double d0 = (double) this.position.getZ() + 0.5D; + double d0 = (double) this.position.getZ() + 0.5D;
+ double d1 = (double) this.position.getX() + 0.5D; + double d1 = (double) this.position.getX() + 0.5D;
+ int yLoc = this.position.getY();
+ +
+ if (this.i != null) { + if (this.i != null) {
+ d0 += 0.5D; + d0 += 0.5D;
@ -74,14 +75,14 @@ index 8f988c3..e7829c5 100644
+ d1 += 0.5D; + d1 += 0.5D;
+ } + }
+ +
+ this.world.a((EntityHuman) null, d1, (double) j + 0.5D, d0, SoundEffects.X, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); + this.world.a((EntityHuman) null, d1, (double) yLoc + 0.5D, d0, SoundEffects.X, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ } + }
+ // Paper end + // Paper end
+ +
if (this.world == null) return; // CraftBukkit if (this.world == null) return; // CraftBukkit
this.world.playBlockAction(this.position, this.getBlock(), 1, this.l); this.world.playBlockAction(this.position, this.getBlock(), 1, this.l);
@@ -354,6 +379,33 @@ public class TileEntityChest extends TileEntityLootable implements ITickable, II @@ -354,6 +380,34 @@ public class TileEntityChest extends TileEntityLootable implements ITickable, II
int oldPower = Math.max(0, Math.min(15, this.l)); // CraftBukkit - Get power before new viewer is added int oldPower = Math.max(0, Math.min(15, this.l)); // CraftBukkit - Get power before new viewer is added
--this.l; --this.l;
if (this.world == null) return; // CraftBukkit if (this.world == null) return; // CraftBukkit
@ -98,6 +99,7 @@ index 8f988c3..e7829c5 100644
+ +
+ double d0 = (double) this.getPosition().getX() + 0.5D; + double d0 = (double) this.getPosition().getX() + 0.5D;
+ double d2 = (double) this.getPosition().getZ() + 0.5D; + double d2 = (double) this.getPosition().getZ() + 0.5D;
+ int yLoc = this.position.getY();
+ +
+ if (this.i != null) { + if (this.i != null) {
+ d2 += 0.5D; + d2 += 0.5D;
@ -107,7 +109,7 @@ index 8f988c3..e7829c5 100644
+ d0 += 0.5D; + d0 += 0.5D;
+ } + }
+ +
+ this.world.a((EntityHuman) null, d0, (double) j + 0.5D, d2, SoundEffects.V, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); + this.world.a((EntityHuman) null, d0, (double) yLoc + 0.5D, d2, SoundEffects.V, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ this.j = 0.0F; + this.j = 0.0F;
+ } + }
+ // Paper end + // Paper end

View file

@ -11,4 +11,4 @@ echo ""
echo "" echo ""
echo "" echo ""
echo "Build success!" echo "Build success!"
echo "Copied final jar to $(pwd)/Paperclip.jar" echo "Copied final jar to $(pwd)/paperclip.jar"