From 7e7840e064f375943899af875cb4c555df9a4c12 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> Date: Sun, 22 Feb 2015 02:38:45 -0600 Subject: [PATCH] (Temporarily?) Disable Spigot's TE changes in favor of our own Pending proper benchmarks and a potential rewrite, this appears to be a good short-term solution --- .../Optimize-TileEntity-Ticking.patch | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch b/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch index e79c79f4c6..c076670ca7 100644 --- a/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch +++ b/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch @@ -101,6 +101,62 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private final List a = Lists.newArrayList(); private final List b = Lists.newArrayList(); public final List players = Lists.newArrayList(); +@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + public static String blockLocation; + public List triggerHoppersList = new ArrayList(); // Spigot, When altHopperTicking, tile entities being added go through here. + private org.spigotmc.TickLimiter entityLimiter; +- private org.spigotmc.TickLimiter tileLimiter; +- private int tileTickPosition; ++ //private org.spigotmc.TickLimiter tileLimiter; // PaperSpigot - Disable Spigot's TE handling in favor of our own ++ //private int tileTickPosition; // PaperSpigot - Disable Spigot's TE handling in favor of our own + + public static long chunkToKey(int x, int z) + { +@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + this.getServer().addWorld(this.world); // CraftBukkit + timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings + this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); +- this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); ++ //this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); // PaperSpigot - Disable Spigot's TE handling in favor of our own + } + + public World b() { +@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + // CraftBukkit end + + this.initializeHoppers(); // Spigot - Initializes hoppers which have been added recently. ++ // PaperSpigot Start - Return to previous behavior, theoretically tile entity ticks should no longer be long enough for this to be an issue ++ Iterator iterator = this.tileEntityList.iterator(); + ++ while (iterator.hasNext()) { ++ TileEntity tileentity = (TileEntity) iterator.next(); ++ /* + // Spigot start + int tilesThisCycle = 0; + for (tileLimiter.initTick(); +@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + tileTickPosition++, tilesThisCycle++) { + tileTickPosition = (tileTickPosition < tileEntityList.size()) ? tileTickPosition : 0; + TileEntity tileentity = (TileEntity) this.tileEntityList.get(tileTickPosition); ++ */ ++ // PaperSpigot end + // Spigot start + if (tileentity == null) { + getServer().getLogger().severe("Spigot has detected a null entity and has removed it, preventing a crash"); +- this.tileEntityList.remove(tileTickPosition--); ++ iterator.remove(); // PaperSpigot - Remove Spigot's TE handling in favor of our own + continue; + } + // Spigot end +@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + } + + if (tileentity.x()) { +- this.tileEntityList.remove(tileTickPosition--); ++ iterator.remove(); // PaperSpigot - Remove Spigot's TE handling in favor of our own + this.h.remove(tileentity); + if (this.isLoaded(tileentity.getPosition())) { + this.getChunkAtWorldCoords(tileentity.getPosition()).e(tileentity.getPosition()); diff --git a/src/main/java/org/github/paperspigot/WorldTileEntityList.java b/src/main/java/org/github/paperspigot/WorldTileEntityList.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000