2018-01-11 06:31:19 +01:00
|
|
|
From 3d6cb4ebf342f11117a6c6952be569b6f6a610d5 Mon Sep 17 00:00:00 2001
|
2016-05-25 03:08:40 +02: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
|
2017-06-19 03:36:55 +02:00
|
|
|
index 5b0028a7..429f26ed 100644
|
2016-05-25 03:08:40 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
|
2017-05-14 20:05:01 +02:00
|
|
|
@@ -94,9 +94,17 @@ public class BlockRedstoneTorch extends BlockTorch {
|
2016-05-25 03:08:40 +02:00
|
|
|
boolean flag = this.g(world, blockposition, iblockdata);
|
|
|
|
List list = (List) BlockRedstoneTorch.g.get(world);
|
|
|
|
|
|
|
|
- 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();
|
2017-05-14 20:05:01 +02:00
|
|
|
@@ -179,7 +187,7 @@ public class BlockRedstoneTorch extends BlockTorch {
|
2016-05-25 03:08:40 +02:00
|
|
|
static class RedstoneUpdateInfo {
|
|
|
|
|
|
|
|
BlockPosition a;
|
|
|
|
- long b;
|
|
|
|
+ long b; final long getTime() { return this.b; } // Paper - OBFHELPER
|
|
|
|
|
|
|
|
public RedstoneUpdateInfo(BlockPosition blockposition, long i) {
|
|
|
|
this.a = blockposition;
|
|
|
|
--
|
2018-01-11 06:31:19 +01:00
|
|
|
2.14.3
|
2016-05-25 03:08:40 +02:00
|
|
|
|