Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/Spigot-Server-Patches/0032-Don-t-tick-chests.patch
2014-08-17 17:15:18 -05:00

148 Zeilen
5.3 KiB
Diff

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..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 - Ixnay on the Chest tick-ay
+ /*
super.h();
if (this.world == null) return; // CraftBukkit
this.i();
@@ -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 +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);
+ // PaperSpigot start - Move chest open sound handling down here
+ this.i();
+ double d0;
+
+ if (this.o > 0 && this.m == 0.0F && this.i == null && this.k == null) {
+ double d1 = (double) this.x + 0.5D;
+
+ d0 = (double) this.z + 0.5D;
+ if (this.l != null) {
+ d0 += 0.5D;
+ }
+
+ if (this.j != null) {
+ d1 += 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
+
// CraftBukkit start - Call redstone event
if (this.q() == Blocks.TRAPPED_CHEST) {
int newPower = Math.max(0, Math.min(15, this.o));
@@ -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);
+ // PaperSpigot start - Move chest close sound handling down here
+ this.i();
+ double d0;
+
+ if (this.o == 0 && this.i == null && this.k == null) {
+ d0 = (double) this.x + 0.5D;
+ double d2 = (double) this.z + 0.5D;
+
+ if (this.l != null) {
+ d2 += 0.5D;
+ }
+
+ if (this.j != null) {
+ d0 += 0.5D;
+ }
+
+ this.world.makeSound(d0, (double) this.y + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ }
+ // PaperSpigot end
+
// 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