Skip to content

Commit

Permalink
Preparations for custom worldgen, addresses #21
Browse files Browse the repository at this point in the history
Renamed ChunkProviderServer to ChunkProvider.
We're going to use it to implement custom generator logic.
  • Loading branch information
damagefilter committed May 23, 2013
1 parent f72b713 commit 2cfb7bc
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
package net.canarymod.api.world;


public interface ChunkProviderServer {
/**
* Chunk Provider interface. This has two purposes.<br>
* One is to wrap the ChunkProviderServer in the NMS implementation.
* <br>
* The other, much more interesting purpose is to be implemented by Plugins,
* then mapped to dimension types - in order to provide custom world generation.<br>
* <h4>Custom World Generation</h4>
* 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
Expand Down Expand Up @@ -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.<br>
* 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
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/canarymod/api/world/World.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2cfb7bc

Please sign in to comment.