From 30960fd721d24f27d1ce58cbea358f11b9ed41ea Mon Sep 17 00:00:00 2001 From: Prototik Date: Fri, 23 Oct 2015 20:04:48 +0700 Subject: [PATCH] Fix #222 --- .../server/MinecraftServer.java.patch | 28 +++++++++---------- .../minecraft/world/WorldServer.java.patch | 22 +++++++++++---- .../org/bukkit/craftbukkit/SpigotTimings.java | 2 -- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/patches/net/minecraft/server/MinecraftServer.java.patch b/patches/net/minecraft/server/MinecraftServer.java.patch index f0a245d..f07120c 100644 --- a/patches/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/net/minecraft/server/MinecraftServer.java.patch @@ -666,7 +666,7 @@ int i; Integer[] ids = DimensionManager.getIDs(this.tickCounter % 200 == 0); -@@ -602,19 +890,22 @@ +@@ -602,19 +890,21 @@ int id = ids[x]; long j = System.nanoTime(); @@ -676,7 +676,6 @@ + //if (id == 0 || this.getAllowNether()) + //{ WorldServer worldserver = DimensionManager.getWorld(id); -+ worldserver.timings.fullTick.startTiming(); // KCauldron this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName()); this.theProfiler.startSection("pools"); this.theProfiler.endSection(); @@ -692,7 +691,7 @@ this.theProfiler.startSection("tick"); FMLCommonHandler.instance().onPreWorldTick(worldserver); -@@ -622,22 +913,46 @@ +@@ -622,22 +912,46 @@ try { @@ -741,7 +740,7 @@ worldserver.addWorldInfoToCrashReport(crashreport); throw new ReportedException(crashreport); } -@@ -645,10 +960,13 @@ +@@ -645,10 +959,12 @@ FMLCommonHandler.instance().onPostWorldTick(worldserver); this.theProfiler.endSection(); this.theProfiler.startSection("tracker"); @@ -751,12 +750,11 @@ this.theProfiler.endSection(); this.theProfiler.endSection(); - } -+ worldserver.timings.fullTick.stopTiming(); // KCauldron + // } // CraftBukkit worldTickTimes.get(id)[this.tickCounter % 100] = System.nanoTime() - j; } -@@ -656,15 +974,21 @@ +@@ -656,15 +972,21 @@ this.theProfiler.endStartSection("dim_unloading"); DimensionManager.unloadWorlds(worldTickTimes); this.theProfiler.endStartSection("connection"); @@ -778,7 +776,7 @@ this.theProfiler.endSection(); } -@@ -699,6 +1023,13 @@ +@@ -699,6 +1021,13 @@ public WorldServer worldServerForDimension(int p_71218_1_) { @@ -792,7 +790,7 @@ WorldServer ret = DimensionManager.getWorld(p_71218_1_); if (ret == null) { -@@ -784,13 +1115,14 @@ +@@ -784,13 +1113,14 @@ public List getPossibleCompletions(ICommandSender p_71248_1_, String p_71248_2_) { @@ -811,7 +809,7 @@ if (list != null) { -@@ -798,40 +1130,25 @@ +@@ -798,40 +1128,25 @@ while (iterator.hasNext()) { @@ -860,7 +858,7 @@ } public static MinecraftServer getServer() -@@ -1034,7 +1351,7 @@ +@@ -1034,7 +1349,7 @@ public boolean isServerInOnlineMode() { @@ -869,7 +867,7 @@ } public void setOnlineMode(boolean p_71229_1_) -@@ -1124,7 +1441,7 @@ +@@ -1124,7 +1439,7 @@ public NetworkSystem func_147137_ag() { @@ -878,7 +876,7 @@ } @SideOnly(Side.CLIENT) -@@ -1259,8 +1576,11 @@ +@@ -1259,8 +1574,11 @@ { Bootstrap.func_151354_b(); @@ -890,7 +888,7 @@ boolean flag = true; String s = null; String s1 = "."; -@@ -1356,16 +1676,34 @@ +@@ -1356,16 +1674,34 @@ { dedicatedserver.setGuiEnabled(); } @@ -931,7 +929,7 @@ } catch (Exception exception) { -@@ -1400,15 +1738,70 @@ +@@ -1400,15 +1736,70 @@ @SideOnly(Side.SERVER) public String getPlugins() { @@ -1007,7 +1005,7 @@ } @SideOnly(Side.SERVER) -@@ -1455,9 +1848,226 @@ +@@ -1455,9 +1846,226 @@ return this.serverStopped; } diff --git a/patches/net/minecraft/world/WorldServer.java.patch b/patches/net/minecraft/world/WorldServer.java.patch index 5759fc6..35da48f 100644 --- a/patches/net/minecraft/world/WorldServer.java.patch +++ b/patches/net/minecraft/world/WorldServer.java.patch @@ -425,16 +425,19 @@ { if (this.updateEntityTick++ >= 1200) { -@@ -498,7 +681,7 @@ +@@ -496,9 +679,9 @@ + + public boolean tickUpdates(boolean p_72955_1_) { - int i = this.pendingTickListEntriesTreeSet.size(); +- int i = this.pendingTickListEntriesTreeSet.size(); ++ int i = this.pendingTickListEntriesHashSet.size(); - if (i != this.pendingTickListEntriesHashSet.size()) -+ if (i != this.pendingTickListEntriesHashSet.size() && false) // KCauldron ++ if (false) // KCauldron { throw new IllegalStateException("TickNextTick list out of synch"); } -@@ -506,7 +689,16 @@ +@@ -506,22 +689,31 @@ { if (i > 1000) { @@ -452,7 +455,16 @@ } this.theProfiler.startSection("cleaning"); -@@ -521,7 +713,7 @@ + NextTickListEntry nextticklistentry; + +- for (int j = 0; j < i; ++j) ++ for (Iterator iter = pendingTickListEntriesHashSet.iterator(); i >= 0 && iter.hasNext(); i--) + { +- nextticklistentry = (NextTickListEntry)this.pendingTickListEntriesTreeSet.first(); ++ nextticklistentry = (NextTickListEntry) iter.next(); + + if (!p_72955_1_ && nextticklistentry.scheduledTime > this.worldInfo.getWorldTotalTime()) + { break; } diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java index 2c978ed..64b1cc4 100644 --- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java +++ b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java @@ -138,7 +138,6 @@ public class SpigotTimings { public final CustomTimingsHandler tickEntities; public final CustomTimingsHandler weatherUpdate; public final CustomTimingsHandler cleanupCache; - public final CustomTimingsHandler fullTick; public final CustomTimingsHandler syncChunkLoadTimer; public final CustomTimingsHandler syncChunkLoadDataTimer; @@ -178,7 +177,6 @@ public class SpigotTimings { tickEntities = new CustomTimingsHandler(name + "tickEntities"); weatherUpdate = new CustomTimingsHandler(name + "weatherUpdate"); cleanupCache = new CustomTimingsHandler(name + "cleanupCache"); - fullTick = new CustomTimingsHandler(name + "fullTick"); } } } \ No newline at end of file