From 75f3e084ada72dbebc39f14d0697b6c5b839b451 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 16 Mar 2013 10:17:00 +1100 Subject: [PATCH] Update Spigot to version 1.5. By using this build you agree to the following terms: (read next line) 1) You will not hold SpigotMC responsible for any losses or damages incurred to you by using this build 2) You will report ALL bugs to SpigotMC and not other parties Thanks for all the support and all parties who made this update possible; especially the awesome Spigot community. Sorry for the delay, but we had to fix some crucial bugs. Regressions in this commit: @mikeprimm's smarter chunk ticking patch has been removed as it prevents proper redstone and other block ticking logic. --- CraftBukkit-Patches/0002-Spigot-changes.patch | 170 +----------------- ...Optimize-getTileEntities-performance.patch | 6 +- pom.xml | 34 ++++ 3 files changed, 43 insertions(+), 167 deletions(-) create mode 100644 pom.xml diff --git a/CraftBukkit-Patches/0002-Spigot-changes.patch b/CraftBukkit-Patches/0002-Spigot-changes.patch index 924415029b..9685481231 100644 --- a/CraftBukkit-Patches/0002-Spigot-changes.patch +++ b/CraftBukkit-Patches/0002-Spigot-changes.patch @@ -1,6 +1,6 @@ -From c9ed47ce088878a5e0fdaa3bcf635aa201a6fd82 Mon Sep 17 00:00:00 2001 +From fb119d1c590c5394eecadda95eeea26ccffc25be Mon Sep 17 00:00:00 2001 From: md_5 -Date: Sat, 16 Mar 2013 10:10:46 +1100 +Date: Sat, 16 Mar 2013 10:13:29 +1100 Subject: [PATCH] Spigot changes. --- @@ -22,7 +22,7 @@ Subject: [PATCH] Spigot changes. src/main/java/net/minecraft/server/PlayerList.java | 10 +- .../net/minecraft/server/ThreadLoginVerifier.java | 21 +++ src/main/java/net/minecraft/server/World.java | 152 ++++++++++++++++++--- - .../java/net/minecraft/server/WorldServer.java | 123 ++++++++++++++--- + .../java/net/minecraft/server/WorldServer.java | 36 ++++- .../java/org/bukkit/craftbukkit/CraftServer.java | 45 +++--- .../java/org/bukkit/craftbukkit/CraftWorld.java | 76 ++++++++++- src/main/java/org/bukkit/craftbukkit/Spigot.java | 20 +++ @@ -32,7 +32,7 @@ Subject: [PATCH] Spigot changes. .../org/bukkit/craftbukkit/util/LongHashSet.java | 11 +- .../bukkit/craftbukkit/util/LongObjectHashMap.java | 5 + src/main/resources/configurations/bukkit.yml | 27 ++++ - 28 files changed, 557 insertions(+), 97 deletions(-) + 28 files changed, 488 insertions(+), 79 deletions(-) create mode 100644 src/main/java/org/bukkit/craftbukkit/Spigot.java create mode 100644 src/main/java/org/bukkit/craftbukkit/util/FlatMap.java @@ -710,7 +710,7 @@ index 9c39815..67f2560 100644 entityhuman = (EntityHuman) this.players.get(i); j = MathHelper.floor(entityhuman.locX) + this.random.nextInt(11) - 5; diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index d99b6a3..b806bdf 100644 +index d99b6a3..34f7bb1 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -1,5 +1,7 @@ @@ -729,24 +729,6 @@ index d99b6a3..b806bdf 100644 import org.bukkit.event.block.BlockFormEvent; import org.bukkit.event.weather.LightningStrikeEvent; -@@ -24,7 +27,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate - private final MinecraftServer server; - public EntityTracker tracker; // CraftBukkit - private final -> public - private final PlayerChunkMap manager; -- private Set L; -+ private LongObjectHashMap> L; // CraftBukkit - change to something chunk friendly - private TreeSet M; - public ChunkProviderServer chunkProviderServer; - public boolean savingDisabled; -@@ -53,7 +56,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate - } - - if (this.L == null) { -- this.L = new HashSet(); -+ this.L = new LongObjectHashMap>(); // CraftBukkit - } - - if (this.M == null) { @@ -277,15 +280,30 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate } @@ -788,7 +770,7 @@ index d99b6a3..b806bdf 100644 - block.a(this, k2 + k, i3 + chunksection.d(), l2 + l, this.random); + // Spigot start + if (players < 1) { -+ //grow fast if no players are in this chunk ++ // grow fast if no players are in this chunk + this.growthOdds = modifiedOdds; + } else { + this.growthOdds = 100; @@ -800,146 +782,6 @@ index d99b6a3..b806bdf 100644 } } } -@@ -429,10 +457,11 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate - nextticklistentry.a(j1); - } - -- if (!this.L.contains(nextticklistentry)) { -- this.L.add(nextticklistentry); -- this.M.add(nextticklistentry); -- } -+ // if (!this.L.contains(nextticklistentry)) { -+ // this.L.add(nextticklistentry); -+ // this.M.add(nextticklistentry); -+ // } -+ addNextTickIfNeeded(nextticklistentry); // CraftBukkit - } - } - -@@ -444,10 +473,11 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate - nextticklistentry.a((long) i1 + this.worldData.getTime()); - } - -- if (!this.L.contains(nextticklistentry)) { -- this.L.add(nextticklistentry); -- this.M.add(nextticklistentry); -- } -+ //if (!this.L.contains(nextticklistentry)) { -+ // this.L.add(nextticklistentry); -+ // this.M.add(nextticklistentry); -+ //} -+ addNextTickIfNeeded(nextticklistentry); // CraftBukkit - } - - public void tickEntities() { -@@ -469,9 +499,9 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate - public boolean a(boolean flag) { - int i = this.M.size(); - -- if (i != this.L.size()) { -- throw new IllegalStateException("TickNextTick list out of synch"); -- } else { -+ //if (i != this.L.size()) { // Spigot -+ // throw new IllegalStateException("TickNextTick list out of synch"); // Spigot -+ //} else { // Spigot - if (i > 1000) { - // CraftBukkit start - if the server has too much to process over time, try to alleviate that - if (i > 20 * 1000) { -@@ -492,9 +522,11 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate - break; - } - -- this.M.remove(nextticklistentry); -- this.L.remove(nextticklistentry); -- this.T.add(nextticklistentry); -+ // Spigot start -+ //this.M.remove(nextticklistentry); -+ //this.L.remove(nextticklistentry); -+ this.removeNextTickIfNeeded(nextticklistentry); -+ // Spigot end - } - - this.methodProfiler.b(); -@@ -536,10 +568,12 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate - this.methodProfiler.b(); - this.T.clear(); - return !this.M.isEmpty(); -- } -+ // } // Spigot - } - - public List a(Chunk chunk, boolean flag) { -+ return this.getNextTickEntriesForChunk(chunk, flag); // Spigot -+ /* Spigot start - ArrayList arraylist = null; - ChunkCoordIntPair chunkcoordintpair = chunk.l(); - int i = (chunkcoordintpair.x << 4) - 2; -@@ -578,6 +612,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate - } - - return arraylist; -+ // Spigot end */ - } - - public void entityJoinedWorld(Entity entity, boolean flag) { -@@ -648,7 +683,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate - } - - if (this.L == null) { -- this.L = new HashSet(); -+ this.L = new LongObjectHashMap>(); - } - - if (this.M == null) { -@@ -934,4 +969,48 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate - return this.setTypeIdAndData(x, y, z, typeId, data, 3); - } - // CraftBukkit end -+ -+ // Spigot start -+ private void addNextTickIfNeeded(NextTickListEntry ent) { -+ long coord = LongHash.toLong(ent.a >> 4, ent.c >> 4); -+ Set chunkset = L.get(coord); -+ if (chunkset == null) { -+ chunkset = new HashSet(); -+ L.put(coord, chunkset); -+ } else if (chunkset.contains(ent)) { -+ return; -+ } -+ chunkset.add(ent); -+ M.add(ent); -+ } -+ -+ private void removeNextTickIfNeeded(NextTickListEntry ent) { -+ long coord = LongHash.toLong(ent.a >> 4, ent.c >> 4); -+ Set chunkset = L.get(coord); -+ if (chunkset == null) { -+ return; -+ } -+ if (chunkset.remove(ent)) { -+ M.remove(ent); -+ if (chunkset.isEmpty()) { -+ L.remove(coord); -+ } -+ } -+ } -+ -+ private List getNextTickEntriesForChunk(Chunk chunk, boolean remove) { -+ long coord = LongHash.toLong(chunk.x, chunk.z); -+ Set chunkset = L.get(coord); -+ if (chunkset == null) { -+ return null; -+ } -+ List list = new ArrayList(chunkset); -+ if (remove) { -+ L.remove(coord); -+ M.removeAll(list); -+ chunkset.clear(); -+ } -+ return list; -+ } -+ // Spigot end - } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 3775022..8f65601 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/CraftBukkit-Patches/0025-Optimize-getTileEntities-performance.patch b/CraftBukkit-Patches/0025-Optimize-getTileEntities-performance.patch index 0ce9328fad..2067f1ae11 100644 --- a/CraftBukkit-Patches/0025-Optimize-getTileEntities-performance.patch +++ b/CraftBukkit-Patches/0025-Optimize-getTileEntities-performance.patch @@ -1,4 +1,4 @@ -From 597aeb82a73eed6c5c6af591427a7773fb707bf0 Mon Sep 17 00:00:00 2001 +From 4e69548e7279f907018b2d66fb5e074be25c6ee7 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Wed, 20 Feb 2013 23:07:53 -0500 Subject: [PATCH] Optimize getTileEntities performance @@ -9,10 +9,10 @@ Avoid traversing tile entities for every loaded chunk 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 6ade608..d399e7b 100644 +index 957dbd9..b250438 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -663,17 +663,20 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate +@@ -655,17 +655,20 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate public List getTileEntities(int i, int j, int k, int l, int i1, int j1) { ArrayList arraylist = new ArrayList(); diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000..23fd156bc0 --- /dev/null +++ b/pom.xml @@ -0,0 +1,34 @@ + + + 4.0.0 + + org.spigotmc + spigot-parent + dev-SNAPSHOT + pom + + Spigot-Parent + Parent project for all Spigot modules. + https://github.com/EcoCityCraft/Spigot + + + Spigot-Server + Spigot-API + + + + UTF-8 + + + + + md_5-releases + http://repo.md-5.net/content/repositories/releases/ + + + md_5-snapshots + http://repo.md-5.net/content/repositories/snapshots/ + + +