From 5968b5c6e0e122ba6af43f1dda35980ad898aebf Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sun, 16 Jun 2019 14:00:08 +0100 Subject: [PATCH] Fix enderchests not playing close sound (#2190) --- .../Optimize-TileEntity-Ticking.patch | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch b/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch index dc3a2fc450..2ff1284f0e 100644 --- a/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch +++ b/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch @@ -90,7 +90,7 @@ index 271406f8bb..85b450c054 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 340dd1dafe..422b124a6c 100644 +index 340dd1dafe..14598d7ee9 100644 --- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java +++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java @@ -0,0 +0,0 @@ @@ -138,15 +138,35 @@ index 340dd1dafe..422b124a6c 100644 + // Paper start + } +- if (this.c == 0 && this.a > 0.0F || this.c > 0 && this.a < 1.0F) { + private void doCloseLogic() { + int i = this.position.getX(); + int j = this.position.getY(); + int k = this.position.getZ(); + double d0; ++ ++ if (this.c == 0) { /* && this.a > 0.0F || this.c > 0 && this.a < 1.0F) { + // Paper end - if (this.c == 0 && this.a > 0.0F || this.c > 0 && this.a < 1.0F) { float f1 = this.a; + if (this.c > 0) { +@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { + float f2 = 0.5F; + + if (this.a < 0.5F && f1 >= 0.5F) { ++ // Paper start ++ */ + d0 = (double) i + 0.5D; + double d2 = (double) k + 0.5D; + ++ MCUtil.scheduleTask(10, () -> { + this.world.a((EntityHuman) null, d0, (double) j + 0.5D, d2, SoundEffects.BLOCK_ENDER_CHEST_CLOSE, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); +- } ++ }); ++ // Paper end + + if (this.a < 0.0F) { + this.a = 0.0F; @@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { public void d() { ++this.c;