Don't tick enderchests either

This commit is contained in:
Zach Brown 2014-08-17 17:15:18 -05:00
parent a4647a8a71
commit f88a3838c0

View File

@ -1,31 +1,32 @@
From 6331ec0f4754f0bf76c11e52a3d1ca1dac0925df Mon Sep 17 00:00:00 2001
From 662acf6926a1381394de4cf4e79540092912c20e Mon Sep 17 00:00:00 2001
From: Iceee <andrew@opticgaming.tv>
Date: Fri, 11 Jul 2014 01:31:43 -0500
Subject: [PATCH] Don't tick chests
diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java
index c900caf..ce612ad 100644
index c900caf..19eff35 100644
--- a/src/main/java/net/minecraft/server/TileEntityChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityChest.java
@@ -249,6 +249,8 @@ public class TileEntityChest extends TileEntity implements IInventory {
}
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
this.i();
@@ -327,6 +329,7 @@ public class TileEntityChest extends TileEntity implements IInventory {
@@ -327,6 +329,8 @@ public class TileEntityChest extends TileEntity implements IInventory {
this.m = 0.0F;
}
}
+ */
+ // PaperSpigot end
}
public boolean c(int i, int j) {
@@ -349,6 +352,26 @@ public class TileEntityChest extends TileEntity implements IInventory {
@@ -349,6 +353,26 @@ public class TileEntityChest extends TileEntity implements IInventory {
if (this.world == null) return; // CraftBukkit
this.world.playBlockAction(this.x, this.y, this.z, this.q(), 1, this.o);
@ -52,7 +53,7 @@ index c900caf..ce612ad 100644
// CraftBukkit start - Call redstone event
if (this.q() == Blocks.TRAPPED_CHEST) {
int newPower = Math.max(0, Math.min(15, this.o));
@@ -371,6 +394,26 @@ public class TileEntityChest extends TileEntity implements IInventory {
@@ -371,6 +395,26 @@ public class TileEntityChest extends TileEntity implements IInventory {
if (this.world == null) return; // CraftBukkit
this.world.playBlockAction(this.x, this.y, this.z, this.q(), 1, this.o);
@ -79,6 +80,68 @@ index c900caf..ce612ad 100644
// 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 b205ab7..158f2e0 100644
--- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
@@ -10,6 +10,8 @@ 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);
@@ -52,6 +54,8 @@ public class TileEntityEnderChest extends TileEntity {
this.a = 0.0F;
}
}
+ */
+ // PaperSpigot end
}
public boolean c(int i, int j) {
@@ -71,11 +75,39 @@ 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) {
--
1.9.1