From 77959421f4d73634935e975b5faf00744626033e Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Sun, 15 Mar 2015 21:45:15 +0000 Subject: [PATCH] Upstream merge --- CraftBukkit-Patches/0012-Spigot-Timings.patch | 22 +++++----- ...b-Spawning-Relative-to-View-Distance.patch | 8 ++-- ...Disabling-of-Random-Lighting-Updates.patch | 6 +-- .../0032-Properly-Close-Inventories.patch | 8 ++-- ...-chunks-not-being-sent-to-the-client.patch | 6 +-- .../0071-Improve-AutoSave-Mechanism.patch | 8 ++-- ...5-Use-Standard-List-for-EntitySlices.patch | 41 +++++++++++++++---- 7 files changed, 63 insertions(+), 36 deletions(-) diff --git a/CraftBukkit-Patches/0012-Spigot-Timings.patch b/CraftBukkit-Patches/0012-Spigot-Timings.patch index abd75f5..7f6613d 100644 --- a/CraftBukkit-Patches/0012-Spigot-Timings.patch +++ b/CraftBukkit-Patches/0012-Spigot-Timings.patch @@ -1,4 +1,4 @@ -From 739f6434a2df8ab24912fb5dcbb74738b8ae3bde Mon Sep 17 00:00:00 2001 +From af32f61251756eed8678c094bd25e585b6397e76 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 10 Jan 2013 00:18:11 -0500 Subject: [PATCH] Spigot Timings @@ -6,10 +6,10 @@ Subject: [PATCH] Spigot Timings Overhauls the Timings System adding performance tracking all around the Minecraft Server diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index aade3f5..cfcd71e 100644 +index 1deeac6..3a05d9d 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -893,6 +893,7 @@ public class Chunk { +@@ -895,6 +895,7 @@ public class Chunk { } public void loadNearby(IChunkProvider ichunkprovider, IChunkProvider ichunkprovider1, int i, int j) { @@ -17,7 +17,7 @@ index aade3f5..cfcd71e 100644 boolean flag = ichunkprovider.isChunkLoaded(i, j - 1); boolean flag1 = ichunkprovider.isChunkLoaded(i + 1, j); boolean flag2 = ichunkprovider.isChunkLoaded(i, j + 1); -@@ -939,6 +940,7 @@ public class Chunk { +@@ -941,6 +942,7 @@ public class Chunk { } } @@ -26,7 +26,7 @@ index aade3f5..cfcd71e 100644 public BlockPosition h(BlockPosition blockposition) { diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 5d75348..e7cdb4e 100644 +index 63d548c..c143d01 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -132,6 +132,7 @@ public class ChunkProviderServer implements IChunkProvider { @@ -37,7 +37,7 @@ index 5d75348..e7cdb4e 100644 chunk = this.loadChunk(i, j); if (chunk == null) { if (this.chunkProvider == null) { -@@ -182,6 +183,7 @@ public class ChunkProviderServer implements IChunkProvider { +@@ -188,6 +189,7 @@ public class ChunkProviderServer implements IChunkProvider { } // CraftBukkit end chunk.loadNearby(this, this, i, j); @@ -45,7 +45,7 @@ index 5d75348..e7cdb4e 100644 } return chunk; -@@ -216,7 +218,9 @@ public class ChunkProviderServer implements IChunkProvider { +@@ -222,7 +224,9 @@ public class ChunkProviderServer implements IChunkProvider { if (chunk != null) { chunk.setLastSaved(this.world.getTime()); if (this.chunkProvider != null) { @@ -242,7 +242,7 @@ index 256953f..24aaec5 100644 this.world.methodProfiler.b(); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 738fb52..96d38b6 100644 +index 611a623..af2e9bc 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -46,6 +46,7 @@ import joptsimple.OptionSet; @@ -529,7 +529,7 @@ index f55bfed..64f82f7 100644 } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 2a7b68f..ce76d4b 100644 +index d922a27..6b18563 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -216,10 +216,13 @@ public class WorldServer extends World implements IAsyncTaskHandler { @@ -791,10 +791,10 @@ index 0000000..558574f + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java -index 5b56898..5f58a59 100644 +index 0f445df..a43870a 100644 --- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java +++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java -@@ -47,7 +47,9 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider Date: Fri, 21 Jun 2013 17:29:54 +1000 Subject: [PATCH] Fix Mob Spawning Relative to View Distance @@ -8,7 +8,7 @@ Changes the mob spawning algorithm to properly account for view distance and the Needs better documentation. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index cfcd71e..92b25f0 100644 +index 3a05d9d..633af1d 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -42,6 +42,7 @@ public class Chunk { @@ -19,7 +19,7 @@ index cfcd71e..92b25f0 100644 // CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking private int neighbors = 0x1 << 12; -@@ -674,6 +675,22 @@ public class Chunk { +@@ -676,6 +677,22 @@ public class Chunk { entity.af = k; entity.ag = this.locZ; this.entitySlices[k].add(entity); @@ -42,7 +42,7 @@ index cfcd71e..92b25f0 100644 } public void b(Entity entity) { -@@ -690,6 +707,22 @@ public class Chunk { +@@ -692,6 +709,22 @@ public class Chunk { } this.entitySlices[i].remove(entity); diff --git a/CraftBukkit-Patches/0031-Allow-Disabling-of-Random-Lighting-Updates.patch b/CraftBukkit-Patches/0031-Allow-Disabling-of-Random-Lighting-Updates.patch index 906191f..5a44c39 100644 --- a/CraftBukkit-Patches/0031-Allow-Disabling-of-Random-Lighting-Updates.patch +++ b/CraftBukkit-Patches/0031-Allow-Disabling-of-Random-Lighting-Updates.patch @@ -1,14 +1,14 @@ -From e9eade2eb7eecfd2247bd86317fea7ec51a6e989 Mon Sep 17 00:00:00 2001 +From e29f11efa7283205faa6af14ebdfc716ce72ca14 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 22 Jun 2013 16:12:02 +1000 Subject: [PATCH] Allow Disabling of Random Lighting Updates diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 92b25f0..ab971cf 100644 +index 633af1d..0bc0dce 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -1011,7 +1011,7 @@ public class Chunk { +@@ -1013,7 +1013,7 @@ public class Chunk { } this.p = true; diff --git a/CraftBukkit-Patches/0032-Properly-Close-Inventories.patch b/CraftBukkit-Patches/0032-Properly-Close-Inventories.patch index f6f0632..b81ddd0 100644 --- a/CraftBukkit-Patches/0032-Properly-Close-Inventories.patch +++ b/CraftBukkit-Patches/0032-Properly-Close-Inventories.patch @@ -1,4 +1,4 @@ -From 855af52bcc82a9b02da539c3c836d547e460d8d5 Mon Sep 17 00:00:00 2001 +From 682ecbd7928f83c0604da582d3fc965bd4a98fde Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 27 Jun 2013 17:26:09 +1000 Subject: [PATCH] Properly Close Inventories @@ -6,10 +6,10 @@ Subject: [PATCH] Properly Close Inventories Properly close inventories when unloading and switching worlds. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index ab971cf..5f07158 100644 +index 0bc0dce..a17aa1d 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -820,6 +820,18 @@ public class Chunk { +@@ -822,6 +822,18 @@ public class Chunk { while (iterator.hasNext()) { TileEntity tileentity = (TileEntity) iterator.next(); @@ -28,7 +28,7 @@ index ab971cf..5f07158 100644 this.world.b(tileentity); } -@@ -830,6 +842,18 @@ public class Chunk { +@@ -832,6 +844,18 @@ public class Chunk { java.util.Iterator iter = newList.iterator(); while (iter.hasNext()) { Entity entity = iter.next(); diff --git a/CraftBukkit-Patches/0051-Fix-some-chunks-not-being-sent-to-the-client.patch b/CraftBukkit-Patches/0051-Fix-some-chunks-not-being-sent-to-the-client.patch index f0499f0..2fadca4 100644 --- a/CraftBukkit-Patches/0051-Fix-some-chunks-not-being-sent-to-the-client.patch +++ b/CraftBukkit-Patches/0051-Fix-some-chunks-not-being-sent-to-the-client.patch @@ -1,14 +1,14 @@ -From 3705cb92a2a8adc06ea06c3688700b6979f76a41 Mon Sep 17 00:00:00 2001 +From 31992935ee360dd1757af14e842d68a02a485807 Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Mon, 2 Dec 2013 23:42:09 +0000 Subject: [PATCH] Fix some chunks not being sent to the client diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 5f07158..b2ce05f 100644 +index a17aa1d..bcb6683 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -1053,7 +1053,15 @@ public class Chunk { +@@ -1055,7 +1055,15 @@ public class Chunk { } public boolean isReady() { diff --git a/CraftBukkit-Patches/0071-Improve-AutoSave-Mechanism.patch b/CraftBukkit-Patches/0071-Improve-AutoSave-Mechanism.patch index 1d6b1a9..62ac9a5 100644 --- a/CraftBukkit-Patches/0071-Improve-AutoSave-Mechanism.patch +++ b/CraftBukkit-Patches/0071-Improve-AutoSave-Mechanism.patch @@ -1,4 +1,4 @@ -From 2b6bdb57c6ac9923c2c1fca0085c8963571c308d Mon Sep 17 00:00:00 2001 +From 0d795dbf31bfd057ffb8e290a2795924455290f1 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 12 Jan 2014 21:07:18 +1100 Subject: [PATCH] Improve AutoSave Mechanism @@ -11,10 +11,10 @@ Instead we will mimic the save-all command in its behaviour, which is both safe Also, only save modified chunks, or chunks with entities after 4 auto save passes diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index b2ce05f..a59ff8e 100644 +index bcb6683..109b657 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -934,7 +934,7 @@ public class Chunk { +@@ -936,7 +936,7 @@ public class Chunk { if (this.r && this.world.getTime() != this.lastSaved || this.q) { return true; } @@ -24,7 +24,7 @@ index b2ce05f..a59ff8e 100644 } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d2c4e6f..4784bbc 100644 +index 3dd4201..4c254a7 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -651,7 +651,17 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs diff --git a/CraftBukkit-Patches/0155-Use-Standard-List-for-EntitySlices.patch b/CraftBukkit-Patches/0155-Use-Standard-List-for-EntitySlices.patch index 73db8db..02d72af 100644 --- a/CraftBukkit-Patches/0155-Use-Standard-List-for-EntitySlices.patch +++ b/CraftBukkit-Patches/0155-Use-Standard-List-for-EntitySlices.patch @@ -1,11 +1,11 @@ -From 52f937dd4b3d4cfa5bd12c17bd4b38400459bcef Mon Sep 17 00:00:00 2001 +From 85a19c23ec2e95de28cb094814b9c24b9f44878e Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 20 Feb 2015 21:33:36 +1100 Subject: [PATCH] Use Standard List for EntitySlices. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index a59ff8e..5794345 100644 +index 109b657..d70f979 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -31,7 +31,7 @@ public class Chunk { @@ -17,7 +17,7 @@ index a59ff8e..5794345 100644 private boolean done; private boolean lit; private boolean p; -@@ -80,14 +80,14 @@ public class Chunk { +@@ -80,7 +80,7 @@ public class Chunk { this.tileEntities = Maps.newHashMap(); this.v = 4096; this.w = Queues.newConcurrentLinkedQueue(); @@ -26,15 +26,16 @@ index a59ff8e..5794345 100644 this.world = world; this.locX = i; this.locZ = j; - this.heightMap = new int[256]; +@@ -88,7 +88,7 @@ public class Chunk { + /* CraftBukkit start for (int k = 0; k < this.entitySlices.length; ++k) { - this.entitySlices[k] = new EntitySlice(Entity.class); + this.entitySlices[k] = new org.bukkit.craftbukkit.util.UnsafeList(); // Spigot } + // CraftBukkit end */ - Arrays.fill(this.f, -999); -@@ -916,12 +916,12 @@ public class Chunk { +@@ -918,12 +918,12 @@ public class Chunk { j = MathHelper.clamp(j, 0, this.entitySlices.length - 1); for (int k = i; k <= j; ++k) { @@ -49,7 +50,7 @@ index a59ff8e..5794345 100644 list.add((T) entity); // Fix decompile error } } -@@ -1301,7 +1301,7 @@ public class Chunk { +@@ -1303,7 +1303,7 @@ public class Chunk { return this.tileEntities; } @@ -58,6 +59,32 @@ index a59ff8e..5794345 100644 return this.entitySlices; } +diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +index c143d01..4ac27d0 100644 +--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +@@ -157,7 +157,7 @@ public class ChunkProviderServer implements IChunkProvider { + + // CraftBukkit start - moved from Chunk. + for (int k = 0; k < chunk.entitySlices.length; ++k) { +- chunk.entitySlices[k] = new EntitySlice(Entity.class); ++ chunk.entitySlices[k] = new org.bukkit.craftbukkit.util.UnsafeList(); // Spigot + } + // CraftBukkit end + chunk.addEntities(); +diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java +index a43870a..f099976 100644 +--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java ++++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java +@@ -44,7 +44,7 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider + for (int k = 0; k < chunk.entitySlices.length; ++k) { +- chunk.entitySlices[k] = new EntitySlice(Entity.class); ++ chunk.entitySlices[k] = new org.bukkit.craftbukkit.util.UnsafeList(); // Spigot + } + + queuedChunk.loader.loadEntities(chunk, queuedChunk.compound.getCompound("Level"), queuedChunk.world); diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java index 0143623..621a717 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java