From 3fce0ec0f5462b0478c6b85ae5c8026f69a2911b Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Sun, 22 Mar 2015 19:01:30 +0000 Subject: SPIGOT-729: Revert the entity slice move --- nms-patches/Chunk.patch | 26 ++++++++------------- nms-patches/ChunkProviderServer.patch | 27 +++++++++------------- nms-patches/ChunkRegionLoader.patch | 12 ++++------ .../java/org/bukkit/craftbukkit/CraftWorld.java | 4 ---- 4 files changed, 24 insertions(+), 45 deletions(-) diff --git a/nms-patches/Chunk.patch b/nms-patches/Chunk.patch index 9998e15a..b13ccf09 100644 --- a/nms-patches/Chunk.patch +++ b/nms-patches/Chunk.patch @@ -1,5 +1,5 @@ ---- /home/matt/mc-dev-private//net/minecraft/server/Chunk.java 2015-03-16 09:47:02.911222177 +0000 -+++ src/main/java/net/minecraft/server/Chunk.java 2015-03-16 09:47:02.911222177 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/Chunk.java 2015-03-22 19:01:20.013879491 +0000 ++++ src/main/java/net/minecraft/server/Chunk.java 2015-03-22 19:01:20.013879491 +0000 @@ -14,6 +14,9 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -63,15 +63,7 @@ public Chunk(World world, int i, int j) { this.sections = new ChunkSection[16]; this.e = new byte[256]; -@@ -54,14 +85,25 @@ - this.locZ = j; - this.heightMap = new int[256]; - -+ /* CraftBukkit start - for (int k = 0; k < this.entitySlices.length; ++k) { - this.entitySlices[k] = new EntitySlice(Entity.class); - } -+ // CraftBukkit end */ +@@ -60,8 +91,17 @@ Arrays.fill(this.f, -999); Arrays.fill(this.e, (byte) -1); @@ -89,7 +81,7 @@ public Chunk(World world, ChunkSnapshot chunksnapshot, int i, int j) { this(world, i, j); short short0 = 256; -@@ -529,7 +571,8 @@ +@@ -529,7 +569,8 @@ } } @@ -99,7 +91,7 @@ block.onPlace(this.world, blockposition, iblockdata); } -@@ -610,7 +653,11 @@ +@@ -610,7 +651,11 @@ int j = MathHelper.floor(entity.locZ / 16.0D); if (i != this.locX || j != this.locZ) { @@ -112,7 +104,7 @@ entity.die(); } -@@ -662,7 +709,15 @@ +@@ -662,7 +707,15 @@ } public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) { @@ -129,7 +121,7 @@ if (tileentity == null) { if (chunk_enumtileentitystate == Chunk.EnumTileEntityState.IMMEDIATE) { -@@ -697,6 +752,13 @@ +@@ -697,6 +750,13 @@ tileentity.D(); this.tileEntities.put(blockposition, tileentity); @@ -143,7 +135,7 @@ } } -@@ -740,7 +802,21 @@ +@@ -740,7 +800,21 @@ } for (int i = 0; i < this.entitySlices.length; ++i) { @@ -166,7 +158,7 @@ } } -@@ -798,8 +874,8 @@ +@@ -798,8 +872,8 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); diff --git a/nms-patches/ChunkProviderServer.patch b/nms-patches/ChunkProviderServer.patch index c7d01ea3..7f933142 100644 --- a/nms-patches/ChunkProviderServer.patch +++ b/nms-patches/ChunkProviderServer.patch @@ -1,5 +1,5 @@ ---- /home/matt/mc-dev-private//net/minecraft/server/ChunkProviderServer.java 2015-03-15 21:37:46.552362734 +0000 -+++ src/main/java/net/minecraft/server/ChunkProviderServer.java 2015-03-15 21:37:46.552362734 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ChunkProviderServer.java 2015-03-22 19:01:20.021879491 +0000 ++++ src/main/java/net/minecraft/server/ChunkProviderServer.java 2015-03-22 19:01:20.021879491 +0000 @@ -11,17 +11,28 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -138,7 +138,7 @@ if (chunk == null) { chunk = this.loadChunk(i, j); -@@ -79,16 +144,49 @@ +@@ -79,16 +144,44 @@ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Chunk to be generated"); crashreportsystemdetails.a("Location", (Object) String.format("%d,%d", new Object[] { Integer.valueOf(i), Integer.valueOf(j)})); @@ -155,11 +155,6 @@ - this.chunkList.add(chunk); + this.chunks.put(LongHash.toLong(i, j), chunk); + -+ // CraftBukkit start - moved from Chunk. -+ for (int k = 0; k < chunk.entitySlices.length; ++k) { -+ chunk.entitySlices[k] = new EntitySlice(Entity.class); -+ } -+ // CraftBukkit end chunk.addEntities(); + + // CraftBukkit start @@ -191,7 +186,7 @@ chunk.loadNearby(this, this, i, j); } -@@ -96,12 +194,25 @@ +@@ -96,12 +189,25 @@ } public Chunk getOrCreateChunk(int i, int j) { @@ -220,7 +215,7 @@ if (this.chunkLoader == null) { return null; } else { -@@ -123,7 +234,7 @@ +@@ -123,7 +229,7 @@ } } @@ -229,7 +224,7 @@ if (this.chunkLoader != null) { try { this.chunkLoader.b(this.world, chunk); -@@ -134,7 +245,7 @@ +@@ -134,7 +240,7 @@ } } @@ -238,7 +233,7 @@ if (this.chunkLoader != null) { try { chunk.setLastSaved(this.world.getTime()); -@@ -155,6 +266,30 @@ +@@ -155,6 +261,30 @@ chunk.n(); if (this.chunkProvider != null) { this.chunkProvider.getChunkAt(ichunkprovider, i, j); @@ -269,7 +264,7 @@ chunk.e(); } } -@@ -174,10 +309,12 @@ +@@ -174,10 +304,12 @@ public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate) { int i = 0; @@ -285,7 +280,7 @@ if (flag) { this.saveChunkNOP(chunk); -@@ -205,22 +342,43 @@ +@@ -205,22 +337,43 @@ public boolean unloadChunks() { if (!this.world.savingDisabled) { @@ -336,7 +331,7 @@ if (this.chunkLoader != null) { this.chunkLoader.a(); -@@ -235,7 +393,8 @@ +@@ -235,7 +388,8 @@ } public String getName() { @@ -346,7 +341,7 @@ } public List getMobsFor(EnumCreatureType enumcreaturetype, BlockPosition blockposition) { -@@ -247,7 +406,8 @@ +@@ -247,7 +401,8 @@ } public int getLoadedChunks() { diff --git a/nms-patches/ChunkRegionLoader.patch b/nms-patches/ChunkRegionLoader.patch index d20b6744..a829e2df 100644 --- a/nms-patches/ChunkRegionLoader.patch +++ b/nms-patches/ChunkRegionLoader.patch @@ -1,5 +1,5 @@ ---- /home/matt/mc-dev-private//net/minecraft/server/ChunkRegionLoader.java 2015-03-16 19:44:31.166833062 +0000 -+++ src/main/java/net/minecraft/server/ChunkRegionLoader.java 2015-03-16 19:44:31.166833062 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ChunkRegionLoader.java 2015-03-22 19:01:20.065879491 +0000 ++++ src/main/java/net/minecraft/server/ChunkRegionLoader.java 2015-03-22 19:01:20.065879491 +0000 @@ -25,7 +25,39 @@ this.e = file; } @@ -107,7 +107,7 @@ } chunksection.a(achar); -@@ -326,6 +395,17 @@ +@@ -326,6 +395,13 @@ chunk.a(nbttagcompound.getByteArray("Biomes")); } @@ -116,16 +116,12 @@ + } + + public void loadEntities(Chunk chunk, NBTTagCompound nbttagcompound, World world) { -+ // moved from Chunk. -+ for (int k = 0; k < chunk.entitySlices.length; ++k) { -+ chunk.entitySlices[k] = new EntitySlice(Entity.class); -+ } + // CraftBukkit end + NBTTagList nbttaglist1 = nbttagcompound.getList("Entities", 10); if (nbttaglist1 != null) { -@@ -384,7 +464,7 @@ +@@ -384,7 +460,7 @@ } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 0d80c41b..621c89f6 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -261,10 +261,6 @@ public class CraftWorld implements World { private void chunkLoadPostProcess(net.minecraft.server.Chunk chunk, int cx, int cz) { if (chunk != null) { - // moved from Chunk. - for (int k = 0; k < chunk.entitySlices.length; ++k) { - chunk.entitySlices[k] = new EntitySlice(net.minecraft.server.Entity.class); - } world.chunkProviderServer.chunks.put(LongHash.toLong(cx, cz), chunk); chunk.addEntities(); -- cgit v1.2.3