Fix Chest open/close animations

This commit is contained in:
Aikar
2018-07-22 19:39:56 -04:00
parent 9108f443a8
commit 84b819bcb8
5 changed files with 62 additions and 13 deletions

View File

@@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Tue, 1 Mar 2016 22:01:19 -0600
From: Aikar <aikar@aikar.co>
Date: Sun, 8 Mar 2015 22:55:25 -0600
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 de06bd59a..9b54cbfdc 100644
index a534c441a..591524f1e 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;
@@ -30,7 +30,7 @@ index de06bd59a..9b54cbfdc 100644
+ int i = this.position.getX();
+ int j = this.position.getY();
+ int k = this.position.getZ();
+ if (!this.world.isClientSide && this.f != 0 /*&& (this.k + i + j + k) % 200 == 0*/) { // Paper - comment out tick rate limiter
+ if (false && !this.world.isClientSide && this.f != 0 && (this.k + i + j + k) % 200 == 0) { // Paper - disable block
+ // Paper end
this.f = 0;
f = 5.0F;
@@ -41,7 +41,8 @@ index de06bd59a..9b54cbfdc 100644
- this.e = this.a;
- f = 0.1F;
if (this.f > 0 && this.a == 0.0F) {
- if (this.f > 0 && this.a == 0.0F) {
+ if (this.f == 1 && this.a == 0.0F) { // check == 1 instead of > 0, first open
this.a(SoundEffects.BLOCK_CHEST_OPEN);
}
+ // Paper start
@@ -50,8 +51,29 @@ index de06bd59a..9b54cbfdc 100644
+ this.e = this.a;
+ // Paper end
if (this.f == 0 && this.a > 0.0F || this.f > 0 && this.a < 1.0F) {
- if (this.f == 0 && this.a > 0.0F || this.f > 0 && this.a < 1.0F) {
+ if (this.f == 0/* && this.a > 0.0F || this.f > 0 && this.a < 1.0F*/) { // Paper disable all but player count check
+ /* // Paper disable animation stuff
float f1 = this.a;
if (this.f > 0) {
@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
float f2 = 0.5F;
+
if (this.a < 0.5F && f1 >= 0.5F) {
- this.a(SoundEffects.BLOCK_CHEST_CLOSE);
- }
+ */
+ // add some delay
+ MCUtil.scheduleTask(10, () -> {
+ if (this.f == 0) this.a(SoundEffects.BLOCK_CHEST_CLOSE);
+ });
+ // } // Paper end
if (this.a < 0.0F) {
this.a = 0.0F;
@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
++this.f;
@@ -69,7 +91,7 @@ index de06bd59a..9b54cbfdc 100644
int newPower = Math.max(0, Math.min(15, this.f));
diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
index f275fd1c3..7d7628b04 100644
index 61edd7cc6..9407a8c97 100644
--- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
@@ -0,0 +0,0 @@