2018-07-23 16:39:55 +08:00
|
|
|
From bd9abe1adfe269fd95965e845ff7b18f9edc7d2a Mon Sep 17 00:00:00 2001
|
2016-05-25 09:08:40 +08:00
|
|
|
From: Martin Panzer <postremus1996@googlemail.com>
|
|
|
|
Date: Mon, 23 May 2016 12:12:37 +0200
|
|
|
|
Subject: [PATCH] Faster redstone torch rapid clock removal
|
|
|
|
|
|
|
|
Only resize the the redstone torch list once, since resizing arrays / lists is costly
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
|
2018-07-23 16:39:55 +08:00
|
|
|
index c912fb8ae0..d2246cfb10 100644
|
2016-05-25 09:08:40 +08:00
|
|
|
--- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
|
2018-07-16 23:34:55 +08:00
|
|
|
@@ -63,9 +63,17 @@ public class BlockRedstoneTorch extends BlockTorch {
|
|
|
|
public static void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random, boolean flag) {
|
|
|
|
List list = (List) BlockRedstoneTorch.b.get(world);
|
2016-05-25 09:08:40 +08:00
|
|
|
|
|
|
|
- while (list != null && !list.isEmpty() && world.getTime() - ((BlockRedstoneTorch.RedstoneUpdateInfo) list.get(0)).b > 60L) {
|
|
|
|
- list.remove(0);
|
|
|
|
+ // Paper start
|
|
|
|
+ if (list != null) {
|
|
|
|
+ int index = 0;
|
|
|
|
+ while (index < list.size() && world.getTime() - ((BlockRedstoneTorch.RedstoneUpdateInfo) list.get(index)).getTime() > 60L) {
|
|
|
|
+ index++;
|
|
|
|
+ }
|
|
|
|
+ if (index > 0) {
|
|
|
|
+ list.subList(0, index).clear();
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
+ // Paper end
|
|
|
|
|
|
|
|
// CraftBukkit start
|
|
|
|
org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
|
2018-07-16 23:34:55 +08:00
|
|
|
@@ -169,7 +177,7 @@ public class BlockRedstoneTorch extends BlockTorch {
|
|
|
|
public static class RedstoneUpdateInfo {
|
2016-05-25 09:08:40 +08:00
|
|
|
|
2018-07-16 23:34:55 +08:00
|
|
|
private final BlockPosition a;
|
|
|
|
- private final long b;
|
|
|
|
+ private final long b; final long getTime() { return this.b; } // Paper - OBFHELPER
|
2016-05-25 09:08:40 +08:00
|
|
|
|
|
|
|
public RedstoneUpdateInfo(BlockPosition blockposition, long i) {
|
|
|
|
this.a = blockposition;
|
|
|
|
--
|
2018-07-19 12:42:43 +08:00
|
|
|
2.18.0
|
2016-05-25 09:08:40 +08:00
|
|
|
|