From c0b940d619b95fd14c9e746337afff314341a422 Mon Sep 17 00:00:00 2001 From: Tahg Date: Fri, 11 Feb 2011 02:01:32 -0500 Subject: [PATCH] more chunk fixes --- .../minecraft/server/ChunkProviderServer.java | 26 +++++++++---------- .../net/minecraft/server/LongHashset.java | 6 +++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java index 376ff35515..aab4bdef0a 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -196,20 +196,18 @@ public class ChunkProviderServer implements IChunkProvider { public boolean a() { if (!this.g.C) { - for (int i = 0; i < 100; ++i) { - if (!this.a.isEmpty()) { - // CraftBukkit start - long chunkcoordinates = this.a.popFirst(); - Chunk chunk = e.get(chunkcoordinates); - if (chunk == null) continue; - // CraftBukkit end - chunk.e(); - this.b(chunk); - this.a(chunk); - this.a.remove(chunkcoordinates); - this.e.remove(chunkcoordinates); - this.f.remove(chunk); - } + while (!this.a.isEmpty()) { + // CraftBukkit start + long chunkcoordinates = this.a.popFirst(); + Chunk chunk = e.get(chunkcoordinates); + if (chunk == null) continue; + // CraftBukkit end + chunk.e(); + this.b(chunk); + this.a(chunk); + this.a.remove(chunkcoordinates); + this.e.remove(chunkcoordinates); + this.f.remove(chunk); } if (this.d != null) { diff --git a/src/main/java/net/minecraft/server/LongHashset.java b/src/main/java/net/minecraft/server/LongHashset.java index 5e565a5866..c9c7b81f8e 100644 --- a/src/main/java/net/minecraft/server/LongHashset.java +++ b/src/main/java/net/minecraft/server/LongHashset.java @@ -32,7 +32,7 @@ public class LongHashset extends LongHash { return; } } - outer[0] = inner = Arrays.copyOf(inner, i+1); + outer[outerIdx] = inner = Arrays.copyOf(inner, i+1); inner[i] = key; count++; } @@ -82,12 +82,14 @@ public class LongHashset extends LongHash { count--; long ret = inner[inner.length - 1]; outer[i] = Arrays.copyOf(inner, inner.length - 1); + System.err.println("Removing chunk (" + msw(ret) + ", " + lsw(ret) + ")"); return ret; + } } return 0; } - + public long[] keys() { int index = 0; long ret[] = new long[count];