From 0658d1659cd8c64a7b9aaf8a2d5598817e63aee3 Mon Sep 17 00:00:00 2001 From: themode Date: Tue, 15 Dec 2020 04:21:26 +0100 Subject: [PATCH] Renamed ChunkSupplier#createChunk --- .../java/net/minestom/server/instance/InstanceContainer.java | 2 +- .../minestom/server/instance/MinestomBasicChunkLoader.java | 2 +- .../java/net/minestom/server/utils/chunk/ChunkSupplier.java | 2 +- .../java/net/minestom/server/utils/clone/CloneUtils.java | 5 +++++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/minestom/server/instance/InstanceContainer.java b/src/main/java/net/minestom/server/instance/InstanceContainer.java index 4a5a83dd1..dd6c891d4 100644 --- a/src/main/java/net/minestom/server/instance/InstanceContainer.java +++ b/src/main/java/net/minestom/server/instance/InstanceContainer.java @@ -539,7 +539,7 @@ public class InstanceContainer extends Instance { chunkGenerator.fillBiomes(biomes, chunkX, chunkZ); } - final Chunk chunk = chunkSupplier.getChunk(biomes, chunkX, chunkZ); + final Chunk chunk = chunkSupplier.createChunk(biomes, chunkX, chunkZ); Check.notNull(chunk, "Chunks supplied by a ChunkSupplier cannot be null."); cacheChunk(chunk); diff --git a/src/main/java/net/minestom/server/instance/MinestomBasicChunkLoader.java b/src/main/java/net/minestom/server/instance/MinestomBasicChunkLoader.java index 50ee59561..2469eb14b 100644 --- a/src/main/java/net/minestom/server/instance/MinestomBasicChunkLoader.java +++ b/src/main/java/net/minestom/server/instance/MinestomBasicChunkLoader.java @@ -77,7 +77,7 @@ public class MinestomBasicChunkLoader implements IChunkLoader { // Found, load from result bytes BinaryReader reader = new BinaryReader(bytes); // Create the chunk object using the instance's ChunkSupplier to support multiple implementations - Chunk chunk = instanceContainer.getChunkSupplier().getChunk(null, chunkX, chunkZ); + Chunk chunk = instanceContainer.getChunkSupplier().createChunk(null, chunkX, chunkZ); // Execute the callback once all blocks are placed (allow for multithreaded implementations) chunk.readChunk(reader, callback); return true; diff --git a/src/main/java/net/minestom/server/utils/chunk/ChunkSupplier.java b/src/main/java/net/minestom/server/utils/chunk/ChunkSupplier.java index 56d11b687..1c33308be 100644 --- a/src/main/java/net/minestom/server/utils/chunk/ChunkSupplier.java +++ b/src/main/java/net/minestom/server/utils/chunk/ChunkSupplier.java @@ -20,5 +20,5 @@ public interface ChunkSupplier { * @return a newly {@link Chunk} object, cannot be null */ @NotNull - Chunk getChunk(@Nullable Biome[] biomes, int chunkX, int chunkZ); + Chunk createChunk(@Nullable Biome[] biomes, int chunkX, int chunkZ); } diff --git a/src/main/java/net/minestom/server/utils/clone/CloneUtils.java b/src/main/java/net/minestom/server/utils/clone/CloneUtils.java index f0f9f58fc..3990fb722 100644 --- a/src/main/java/net/minestom/server/utils/clone/CloneUtils.java +++ b/src/main/java/net/minestom/server/utils/clone/CloneUtils.java @@ -6,6 +6,11 @@ import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; +/** + * Convenient interface to deep-copy single object or collections. + *

+ * Most of the methods require object to implement the {@link PublicCloneable} interface. + */ public final class CloneUtils { @Nullable