mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 19:15:32 +01:00
[Bleeding] Remove redundant chunkList from ChunkProviderServer
This ArrayList duplicates part of the functionality of the much more efficient chunk map so can be removed as the map can be used in the few places this was needed.
This commit is contained in:
parent
97ac0a3f14
commit
627cf2ef8b
@ -25,7 +25,6 @@ public class ChunkProviderServer implements IChunkProvider {
|
|||||||
private IChunkLoader e;
|
private IChunkLoader e;
|
||||||
public boolean forceChunkLoad = false; // true -> false
|
public boolean forceChunkLoad = false; // true -> false
|
||||||
public LongObjectHashMap<Chunk> chunks = new LongObjectHashMap<Chunk>();
|
public LongObjectHashMap<Chunk> chunks = new LongObjectHashMap<Chunk>();
|
||||||
public List chunkList = new ArrayList();
|
|
||||||
public WorldServer world;
|
public WorldServer world;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -70,7 +69,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a() {
|
public void a() {
|
||||||
Iterator iterator = this.chunkList.iterator();
|
Iterator iterator = this.chunks.values().iterator(); // CraftBukkit
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Chunk chunk = (Chunk) iterator.next();
|
Chunk chunk = (Chunk) iterator.next();
|
||||||
@ -98,7 +97,6 @@ public class ChunkProviderServer implements IChunkProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.chunks.put(i, j, chunk); // CraftBukkit
|
this.chunks.put(i, j, chunk); // CraftBukkit
|
||||||
this.chunkList.add(chunk);
|
|
||||||
if (chunk != null) {
|
if (chunk != null) {
|
||||||
chunk.addEntities();
|
chunk.addEntities();
|
||||||
}
|
}
|
||||||
@ -216,7 +214,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
|||||||
|
|
||||||
public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate) {
|
public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
Iterator iterator = this.chunkList.iterator();
|
Iterator iterator = this.chunks.values().iterator(); // CraftBukkit
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Chunk chunk = (Chunk) iterator.next();
|
Chunk chunk = (Chunk) iterator.next();
|
||||||
@ -263,7 +261,6 @@ public class ChunkProviderServer implements IChunkProvider {
|
|||||||
this.saveChunkNOP(chunk);
|
this.saveChunkNOP(chunk);
|
||||||
// this.unloadQueue.remove(integer);
|
// this.unloadQueue.remove(integer);
|
||||||
this.chunks.remove(chunkcoordinates); // CraftBukkit
|
this.chunks.remove(chunkcoordinates); // CraftBukkit
|
||||||
this.chunkList.remove(chunk);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
@ -164,7 +164,9 @@ public class CraftWorld implements World {
|
|||||||
if (chunk.mustSave) { // If chunk had previously been queued to save, must do save to avoid loss of that data
|
if (chunk.mustSave) { // If chunk had previously been queued to save, must do save to avoid loss of that data
|
||||||
save = true;
|
save = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
chunk.removeEntities(); // Always remove entities - even if discarding, need to get them out of world table
|
chunk.removeEntities(); // Always remove entities - even if discarding, need to get them out of world table
|
||||||
|
|
||||||
if (save && !(chunk instanceof EmptyChunk)) {
|
if (save && !(chunk instanceof EmptyChunk)) {
|
||||||
world.chunkProviderServer.saveChunk(chunk);
|
world.chunkProviderServer.saveChunk(chunk);
|
||||||
world.chunkProviderServer.saveChunkNOP(chunk);
|
world.chunkProviderServer.saveChunkNOP(chunk);
|
||||||
@ -172,7 +174,6 @@ public class CraftWorld implements World {
|
|||||||
|
|
||||||
world.chunkProviderServer.unloadQueue.remove(x, z);
|
world.chunkProviderServer.unloadQueue.remove(x, z);
|
||||||
world.chunkProviderServer.chunks.remove(x, z);
|
world.chunkProviderServer.chunks.remove(x, z);
|
||||||
world.chunkProviderServer.chunkList.remove(chunk);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -242,7 +243,6 @@ public class CraftWorld implements World {
|
|||||||
private void chunkLoadPostProcess(net.minecraft.server.Chunk chunk, int x, int z) {
|
private void chunkLoadPostProcess(net.minecraft.server.Chunk chunk, int x, int z) {
|
||||||
if (chunk != null) {
|
if (chunk != null) {
|
||||||
world.chunkProviderServer.chunks.put(x, z, chunk);
|
world.chunkProviderServer.chunks.put(x, z, chunk);
|
||||||
world.chunkProviderServer.chunkList.add(chunk);
|
|
||||||
|
|
||||||
chunk.addEntities();
|
chunk.addEntities();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user