diff --git a/src/main/java/net/canarymod/api/world/ChunkProviderServer.java b/src/main/java/net/canarymod/api/world/ChunkProvider.java similarity index 63% rename from src/main/java/net/canarymod/api/world/ChunkProviderServer.java rename to src/main/java/net/canarymod/api/world/ChunkProvider.java index 31550c35..07962a5d 100644 --- a/src/main/java/net/canarymod/api/world/ChunkProviderServer.java +++ b/src/main/java/net/canarymod/api/world/ChunkProvider.java @@ -1,7 +1,18 @@ package net.canarymod.api.world; - -public interface ChunkProviderServer { +/** + * Chunk Provider interface. This has two purposes.
+ * One is to wrap the ChunkProviderServer in the NMS implementation. + *
+ * The other, much more interesting purpose is to be implemented by Plugins, + * then mapped to dimension types - in order to provide custom world generation.
+ *

Custom World Generation

+ * This is the interface everything related to world generation boils down to. + * A world will use this to create its terrain and call the provideChunk methid. + * @author Chris (damagefilter) + * + */ +public interface ChunkProvider { /** * Check if this chunk provider is allowed to save chunks @@ -31,7 +42,25 @@ public interface ChunkProviderServer { public Chunk loadChunk(int x, int z); /** - * Load the given chunk if it is not loaded + * Is called after the large-scale generation is done to populate the world with details. + * For instance glowstone blocks + * The x/z must be chunk coordinates, that means right-shifted by 4 + * @param provider + * @param x + * @param z + */ + public void populate(ChunkProvider provider, int x, int z); + + /** + * Return a String that displays the statistics for this ChunkProvider. + * This will be shown in the servers GUI for instance.
+ * The default NMS method returns the size of the Chunk Cache and the number of dropped chunks + * @return + */ + public String getStatistics(); + + /** + * Reload the given chunk. * The x/z must be chunk coordinates, that means right-shifted by 4 * * @return true when successful, false otherwise diff --git a/src/main/java/net/canarymod/api/world/World.java b/src/main/java/net/canarymod/api/world/World.java index 3776dbd5..03370186 100644 --- a/src/main/java/net/canarymod/api/world/World.java +++ b/src/main/java/net/canarymod/api/world/World.java @@ -352,11 +352,11 @@ public static GameMode fromId(int id) { public Player getClosestPlayer(Entity entity, int distance); /** - * Return this worlds {@link ChunkProviderServer} + * Return this worlds {@link ChunkProvider} * * @return */ - public ChunkProviderServer getChunkProvider(); + public ChunkProvider getChunkProvider(); /** * Check if the chunk where that block is, is loaded