From 706fab83cd2c099b052b173f60fcb8e997252bd1 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Sun, 17 Aug 2014 17:15:18 -0500
Subject: [PATCH] Don't tick enderchests either

---
 Spigot-Server-Patches/Don-t-tick-chests.patch | 65 ++++++++++++++++++-
 1 file changed, 64 insertions(+), 1 deletion(-)

diff --git a/Spigot-Server-Patches/Don-t-tick-chests.patch b/Spigot-Server-Patches/Don-t-tick-chests.patch
index 498f6aafb0..03ad3f7454 100644
--- a/Spigot-Server-Patches/Don-t-tick-chests.patch
+++ b/Spigot-Server-Patches/Don-t-tick-chests.patch
@@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
      }
  
      public void h() {
-+        // PaperSpigot start - Don't tick chests at all, period
++        // PaperSpigot start - Ixnay on the Chest tick-ay
 +        /*
          super.h();
          if (this.world == null) return; // CraftBukkit
@@ -22,6 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
              }
          }
 +        */
++        // PaperSpigot end
      }
  
      public boolean c(int i, int j) {
@@ -79,4 +80,66 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
              // CraftBukkit start - Call redstone event
              if (this.q() == Blocks.TRAPPED_CHEST) {
                  int newPower = Math.max(0, Math.min(15, this.o));
+diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
+index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
+--- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java
++++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
+@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity {
+     public TileEntityEnderChest() {}
+ 
+     public void h() {
++        // PaperSpigot start - Ixnay on the EnderChest tick-ay
++        /*
+         super.h();
+         if (++this.k % 20 * 4 == 0) {
+             this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j);
+@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity {
+                 this.a = 0.0F;
+             }
+         }
++        */
++        // PaperSpigot end
+     }
+ 
+     public boolean c(int i, int j) {
+@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity {
+     public void a() {
+         ++this.j;
+         this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j);
++
++        // PaperSpigot start - Move chest open sound handling down to here
++        double d0;
++
++        if (this.j > 0 && this.a == 0.0F) {
++            double d1 = (double) this.x + 0.5D;
++
++            d0 = (double) this.z + 0.5D;
++            this.world.makeSound(d1, (double) this.y + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
++        }
++        // PaperSpigot end
+     }
+ 
+     public void b() {
+         --this.j;
+         this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j);
++
++        // PaperSpigot start - Move chest close sound handling down to here
++        float f = 0.1F;
++        double d0;
++
++        if (this.j == 0 && this.a == 0.0F || this.j > 0 && this.a < 1.0F) {
++            float f1 = this.a;
++            d0 = (double) this.x + 0.5D;
++            double d2 = (double) this.z + 0.5D;
++
++            this.world.makeSound(d0, (double) this.y + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
++
++            if (this.a < 0.0F) {
++                this.a = 0.0F;
++            }
++        }
++        // PaperSpigot end
+     }
+ 
+     public boolean a(EntityHuman entityhuman) {
 --
\ No newline at end of file