From b9e4b31c68f10026422d0958b6f95ab17176ec1b Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Thu, 2 Sep 2021 12:31:27 +0100 Subject: [PATCH] Clean up ChunkHolder slightly, only trim chunk get if not already present --- .../implementation/chunk/ChunkHolder.java | 27 +------------------ 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/ChunkHolder.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/ChunkHolder.java index 0e9144dea..bf3a12bf5 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/ChunkHolder.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/ChunkHolder.java @@ -505,7 +505,6 @@ public class ChunkHolder> implements IQueueChunk { public IChunkGet get(ChunkHolder chunk) { chunk.getOrCreateGet(); chunk.delegate = BOTH; - chunk.chunkExisting.trim(false); return chunk.chunkExisting; } @@ -574,7 +573,6 @@ public class ChunkHolder> implements IQueueChunk { public BiomeType getBiome(ChunkHolder chunk, int x, int y, int z) { chunk.getOrCreateGet(); chunk.delegate = BOTH; - chunk.chunkExisting.trim(false); return chunk.getBiomeType(x, y, z); } @@ -582,7 +580,6 @@ public class ChunkHolder> implements IQueueChunk { public BlockState getBlock(ChunkHolder chunk, int x, int y, int z) { chunk.getOrCreateGet(); chunk.delegate = BOTH; - chunk.chunkExisting.trim(false); return chunk.getBlock(x, y, z); } @@ -593,7 +590,6 @@ public class ChunkHolder> implements IQueueChunk { ) { chunk.getOrCreateGet(); chunk.delegate = BOTH; - chunk.chunkExisting.trim(false); return chunk.getFullBlock(x, y, z); } @@ -613,7 +609,6 @@ public class ChunkHolder> implements IQueueChunk { } chunk.getOrCreateGet(); chunk.delegate = BOTH; - chunk.chunkExisting.trim(false); return chunk.getSkyLight(x, y, z); } @@ -633,7 +628,6 @@ public class ChunkHolder> implements IQueueChunk { } chunk.getOrCreateGet(); chunk.delegate = BOTH; - chunk.chunkExisting.trim(false); return chunk.getEmittedLight(x, y, z); } @@ -641,7 +635,6 @@ public class ChunkHolder> implements IQueueChunk { public int getBrightness(ChunkHolder chunk, int x, int y, int z) { chunk.getOrCreateGet(); chunk.delegate = BOTH; - chunk.chunkExisting.trim(false); return chunk.getBrightness(x, y, z); } @@ -649,7 +642,6 @@ public class ChunkHolder> implements IQueueChunk { public int getOpacity(ChunkHolder chunk, int x, int y, int z) { chunk.getOrCreateGet(); chunk.delegate = BOTH; - chunk.chunkExisting.trim(false); return chunk.getOpacity(x, y, z); } @@ -657,7 +649,6 @@ public class ChunkHolder> implements IQueueChunk { public int[] getHeightMap(ChunkHolder chunk, HeightMapType type) { chunk.getOrCreateGet(); chunk.delegate = BOTH; - chunk.chunkExisting.trim(false); return chunk.getHeightMap(type); } @@ -665,7 +656,6 @@ public class ChunkHolder> implements IQueueChunk { public void flushLightToGet(ChunkHolder chunk) { chunk.getOrCreateGet(); chunk.delegate = BOTH; - chunk.chunkExisting.trim(false); chunk.flushLightToGet(); } @@ -673,7 +663,6 @@ public class ChunkHolder> implements IQueueChunk { public void setLightingToGet(ChunkHolder chunk, char[][] lighting) { chunk.getOrCreateGet(); chunk.delegate = BOTH; - chunk.chunkExisting.trim(false); chunk.setLightingToGet(lighting, chunk.chunkSet.getMinSectionIndex(), chunk.chunkSet.getMaxSectionIndex()); } @@ -681,7 +670,6 @@ public class ChunkHolder> implements IQueueChunk { public void setSkyLightingToGet(ChunkHolder chunk, char[][] lighting) { chunk.getOrCreateGet(); chunk.delegate = BOTH; - chunk.chunkExisting.trim(false); chunk.setSkyLightingToGet(lighting, chunk.chunkSet.getMinSectionIndex(), chunk.chunkSet.getMaxSectionIndex()); } @@ -689,7 +677,6 @@ public class ChunkHolder> implements IQueueChunk { public void setHeightmapToGet(ChunkHolder chunk, HeightMapType type, int[] data) { chunk.getOrCreateGet(); chunk.delegate = BOTH; - chunk.chunkExisting.trim(false); chunk.setHeightmapToGet(type, data); } }; @@ -699,7 +686,6 @@ public class ChunkHolder> implements IQueueChunk { public IChunkGet get(ChunkHolder chunk) { chunk.getOrCreateGet(); chunk.delegate = BOTH; - chunk.chunkExisting.trim(false); return chunk.chunkExisting; } @@ -728,7 +714,6 @@ public class ChunkHolder> implements IQueueChunk { public BiomeType getBiome(ChunkHolder chunk, int x, int y, int z) { chunk.getOrCreateGet(); chunk.delegate = GET; - chunk.chunkExisting.trim(false); return chunk.getBiomeType(x, y, z); } @@ -736,7 +721,6 @@ public class ChunkHolder> implements IQueueChunk { public BlockState getBlock(ChunkHolder chunk, int x, int y, int z) { chunk.getOrCreateGet(); chunk.delegate = GET; - chunk.chunkExisting.trim(false); return chunk.getBlock(x, y, z); } @@ -747,7 +731,6 @@ public class ChunkHolder> implements IQueueChunk { ) { chunk.getOrCreateGet(); chunk.delegate = GET; - chunk.chunkExisting.trim(false); return chunk.getFullBlock(x, y, z); } @@ -805,7 +788,6 @@ public class ChunkHolder> implements IQueueChunk { public int getSkyLight(ChunkHolder chunk, int x, int y, int z) { chunk.getOrCreateGet(); chunk.delegate = GET; - chunk.chunkExisting.trim(false); return chunk.getSkyLight(x, y, z); } @@ -813,7 +795,6 @@ public class ChunkHolder> implements IQueueChunk { public int getEmittedLight(ChunkHolder chunk, int x, int y, int z) { chunk.getOrCreateGet(); chunk.delegate = GET; - chunk.chunkExisting.trim(false); return chunk.getEmittedLight(x, y, z); } @@ -821,7 +802,6 @@ public class ChunkHolder> implements IQueueChunk { public int getBrightness(ChunkHolder chunk, int x, int y, int z) { chunk.getOrCreateGet(); chunk.delegate = GET; - chunk.chunkExisting.trim(false); return chunk.getBrightness(x, y, z); } @@ -829,7 +809,6 @@ public class ChunkHolder> implements IQueueChunk { public int getOpacity(ChunkHolder chunk, int x, int y, int z) { chunk.getOrCreateGet(); chunk.delegate = GET; - chunk.chunkExisting.trim(false); return chunk.getOpacity(x, y, z); } @@ -837,7 +816,6 @@ public class ChunkHolder> implements IQueueChunk { public int[] getHeightMap(ChunkHolder chunk, HeightMapType type) { chunk.getOrCreateGet(); chunk.delegate = GET; - chunk.chunkExisting.trim(false); return chunk.getHeightMap(type); } @@ -850,7 +828,6 @@ public class ChunkHolder> implements IQueueChunk { public void setLightingToGet(ChunkHolder chunk, char[][] lighting) { chunk.getOrCreateGet(); chunk.delegate = GET; - chunk.chunkExisting.trim(false); chunk.setLightingToGet(lighting, chunk.chunkSet.getMinSectionIndex(), chunk.chunkSet.getMaxSectionIndex()); } @@ -858,7 +835,6 @@ public class ChunkHolder> implements IQueueChunk { public void setSkyLightingToGet(ChunkHolder chunk, char[][] lighting) { chunk.getOrCreateGet(); chunk.delegate = GET; - chunk.chunkExisting.trim(false); chunk.setSkyLightingToGet(lighting, chunk.chunkSet.getMinSectionIndex(), chunk.chunkSet.getMaxSectionIndex()); } @@ -866,7 +842,6 @@ public class ChunkHolder> implements IQueueChunk { public void setHeightmapToGet(ChunkHolder chunk, HeightMapType type, int[] data) { chunk.getOrCreateGet(); chunk.delegate = GET; - chunk.chunkExisting.trim(false); chunk.setHeightmapToGet(type, data); } }; @@ -943,6 +918,7 @@ public class ChunkHolder> implements IQueueChunk { public final IChunkGet getOrCreateGet() { if (chunkExisting == null) { chunkExisting = newWrappedGet(); + chunkExisting.trim(false); } return chunkExisting; } @@ -1003,7 +979,6 @@ public class ChunkHolder> implements IQueueChunk { public synchronized T call(IChunkSet set, Runnable finalize) { if (set != null) { IChunkGet get = getOrCreateGet(); - get.trim(false); boolean postProcess = !(getExtent().getPostProcessor() instanceof EmptyBatchProcessor); get.setCreateCopy(postProcess); set = getExtent().processSet(this, get, set);