mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 20:46:59 +01:00
Fix Chest open/close animations
This commit is contained in:
parent
9a279b3947
commit
b801b4baa8
@ -1,4 +1,4 @@
|
||||
From cfbaba5f9368ad26dde9c81f8a41a73743a39239 Mon Sep 17 00:00:00 2001
|
||||
From 767daac10e6f8de9fccba88decfb0327905f9c9b Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 28 Mar 2016 20:55:47 -0400
|
||||
Subject: [PATCH] MC Utils
|
||||
@ -180,10 +180,10 @@ index a540167d6..add618866 100644
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
new file mode 100644
|
||||
index 000000000..edaa7713d
|
||||
index 000000000..70cdc3f10
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
@@ -0,0 +1,266 @@
|
||||
@@ -0,0 +1,292 @@
|
||||
+package net.minecraft.server;
|
||||
+
|
||||
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
@ -212,6 +212,32 @@ index 000000000..edaa7713d
|
||||
+ return MinecraftServer.getServer().isMainThread();
|
||||
+ }
|
||||
+
|
||||
+ private static class DelayedRunnable implements Runnable {
|
||||
+
|
||||
+ private final int ticks;
|
||||
+ private final Runnable run;
|
||||
+
|
||||
+ private DelayedRunnable(int ticks, Runnable run) {
|
||||
+ this.ticks = ticks;
|
||||
+ this.run = run;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void run() {
|
||||
+ if (ticks <= 0) {
|
||||
+ run.run();
|
||||
+ } else {
|
||||
+ scheduleTask(ticks-1, run);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void scheduleTask(int ticks, Runnable runnable) {
|
||||
+ // We use post to main instead of process queue as we don't want to process these mid tick if
|
||||
+ // Someone uses processQueueWhileWaiting
|
||||
+ MinecraftServer.getServer().postToMainThread(new DelayedRunnable(ticks, runnable));
|
||||
+ }
|
||||
+
|
||||
+ public static void processQueue() {
|
||||
+ Runnable runnable;
|
||||
+ Queue<Runnable> processQueue = getProcessQueue();
|
||||
|
@ -1,11 +1,11 @@
|
||||
From b7e91c371fc4c629af5440e38cd70bfd2a59b293 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Tue, 1 Mar 2016 22:01:19 -0600
|
||||
From 13443f9b6f42a4de1fa7b993ef0a6b9bb3be23e2 Mon Sep 17 00:00:00 2001
|
||||
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
|
||||
@@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
||||
@ -30,18 +30,19 @@ 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;
|
||||
List list = this.world.a(EntityHuman.class, new AxisAlignedBB((double) ((float) i - 5.0F), (double) ((float) j - 5.0F), (double) ((float) k - 5.0F), (double) ((float) (i + 1) + 5.0F), (double) ((float) (j + 1) + 5.0F), (double) ((float) (k + 1) + 5.0F)));
|
||||
@@ -134,11 +140,14 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
|
||||
@@ -134,13 +140,17 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
|
||||
}
|
||||
}
|
||||
|
||||
- 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,9 +51,30 @@ 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;
|
||||
@@ -203,6 +212,7 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
|
||||
|
||||
if (this.f > 0) {
|
||||
@@ -155,9 +165,14 @@ 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;
|
||||
@@ -203,6 +218,7 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
|
||||
|
||||
++this.f;
|
||||
if (this.world == null) return; // CraftBukkit
|
||||
@ -60,7 +82,7 @@ index de06bd59a..9b54cbfdc 100644
|
||||
|
||||
// CraftBukkit start - Call redstone event
|
||||
if (this.getBlock() == Blocks.TRAPPED_CHEST) {
|
||||
@@ -224,6 +234,7 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
|
||||
@@ -224,6 +240,7 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
|
||||
--this.f;
|
||||
|
||||
// CraftBukkit start - Call redstone event
|
||||
@ -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
|
||||
@@ -1,6 +1,6 @@
|
||||
|
@ -1,8 +1,9 @@
|
||||
From 0a6e431075e7177f15c75f170b214b3957ed37de Mon Sep 17 00:00:00 2001
|
||||
From b10258425b32f52227c068e59270453ce6fbaac5 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 3 Mar 2016 01:13:45 -0600
|
||||
Subject: [PATCH] Disable chest cat detection
|
||||
Subject: [PATCH] Configurable Disabling Cat Chest Detection
|
||||
|
||||
Offers a gameplay feature to stop cats from blocking chests
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 26d8dbb60..43aa73e1d 100644
|
||||
@ -19,7 +20,7 @@ index 26d8dbb60..43aa73e1d 100644
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java
|
||||
index d55122c66..f8be07258 100644
|
||||
index 0f6902747..1ad39aca3 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockChest.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockChest.java
|
||||
@@ -235,6 +235,11 @@ public class BlockChest extends BlockTileEntity implements IFluidSource, IFluidC
|
@ -1,11 +1,11 @@
|
||||
From fb8e8823dca02ed4ef2a87cd6c993de3d69a2b91 Mon Sep 17 00:00:00 2001
|
||||
From 3d11f50f3781e08137517897b588503b5eede4d7 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 27 Dec 2016 15:02:42 -0500
|
||||
Subject: [PATCH] String based Action Bar API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
index edaa7713d..70db1cc14 100644
|
||||
index 70cdc3f10..381542e0d 100644
|
||||
--- a/src/main/java/net/minecraft/server/MCUtil.java
|
||||
+++ b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
@@ -1,10 +1,13 @@
|
||||
@ -47,7 +47,7 @@ index edaa7713d..70db1cc14 100644
|
||||
|
||||
public static boolean isMainThread() {
|
||||
return MinecraftServer.getServer().isMainThread();
|
||||
@@ -263,4 +284,13 @@ public final class MCUtil {
|
||||
@@ -289,4 +310,13 @@ public final class MCUtil {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -62,7 +62,7 @@ index edaa7713d..70db1cc14 100644
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 7d4355439..1c8c364d3 100644
|
||||
index dea59d3fa..a546f3118 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -208,6 +208,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 5ba0adc0334b2371f2b4647ac4f91d800402923e Mon Sep 17 00:00:00 2001
|
||||
From f69c68a61170d29cde2e2b8f41e5fcd7601a3d7b Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 15 Jan 2018 22:11:48 -0500
|
||||
Subject: [PATCH] Basic PlayerProfile API
|
||||
@ -404,7 +404,7 @@ index 000000000..3aceb0ea8
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
index 70db1cc14..9ab3844fc 100644
|
||||
index 381542e0d..80927de08 100644
|
||||
--- a/src/main/java/net/minecraft/server/MCUtil.java
|
||||
+++ b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
@@ -1,6 +1,9 @@
|
||||
@ -417,7 +417,7 @@ index 70db1cc14..9ab3844fc 100644
|
||||
import org.apache.commons.lang.exception.ExceptionUtils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
@@ -131,6 +134,10 @@ public final class MCUtil {
|
||||
@@ -157,6 +160,10 @@ public final class MCUtil {
|
||||
return run.get();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user