Check property exists before playing chest close sound
There is an artificial delay added to chest close sounds (of 10 ticks) to make them "feel" more true to vanilla. The problem is that because of this delay it is possible for the block to be removed by the time the sound plays. With 1.14 in the state it is the timing necessary to encounter this issue has increased. The correct fix is to just return early if the property checked for in the TileEntityChest sound method does not exist for the block at the current location. Fixes GH-2074
This commit is contained in:
@@ -5,7 +5,7 @@ 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
|
||||
index 271406f8bb..d606e2e4fd 100644
|
||||
index 271406f8b..85b450c05 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityChest.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityChest.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
||||
@@ -66,6 +66,14 @@ index 271406f8bb..d606e2e4fd 100644
|
||||
if (this.a < 0.0F) {
|
||||
this.a = 0.0F;
|
||||
@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
|
||||
}
|
||||
|
||||
private void a(SoundEffect soundeffect) {
|
||||
+ if (!this.getBlock().hasProperty(BlockChest.b)) { return; } // Paper - this can be delayed, double check exists - Fixes GH-2074
|
||||
BlockPropertyChestType blockpropertychesttype = (BlockPropertyChestType) this.getBlock().get(BlockChest.b);
|
||||
|
||||
if (blockpropertychesttype != BlockPropertyChestType.LEFT) {
|
||||
@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
|
||||
|
||||
++this.viewingCount;
|
||||
if (this.world == null) return; // CraftBukkit
|
||||
@@ -82,7 +90,7 @@ index 271406f8bb..d606e2e4fd 100644
|
||||
int newPower = Math.max(0, Math.min(15, this.viewingCount));
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
|
||||
index 6908f50031..ed5cdf177f 100644
|
||||
index 6908f5003..ed5cdf177 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
|
||||
@@ -0,0 +0,0 @@
|
||||
|
||||
Reference in New Issue
Block a user