2010-12-26 23:22:15 +00:00
|
|
|
package org.bukkit;
|
|
|
|
|
2011-02-02 00:01:33 +01:00
|
|
|
import org.bukkit.block.Block;
|
2011-03-07 14:06:15 -05:00
|
|
|
import org.bukkit.block.BlockState;
|
|
|
|
import org.bukkit.entity.Entity;
|
2011-02-02 00:01:33 +01:00
|
|
|
|
2010-12-26 23:22:15 +00:00
|
|
|
/**
|
|
|
|
* Represents a chunk of blocks
|
|
|
|
*/
|
|
|
|
public interface Chunk {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the X-coordinate of this chunk
|
|
|
|
*
|
|
|
|
* @return X-coordinate
|
|
|
|
*/
|
|
|
|
int getX();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the Z-coordinate of this chunk
|
|
|
|
*
|
|
|
|
* @return Z-coordinate
|
|
|
|
*/
|
|
|
|
int getZ();
|
|
|
|
|
2011-01-04 14:08:29 +00:00
|
|
|
/**
|
|
|
|
* Gets the world containing this chunk
|
|
|
|
*
|
|
|
|
* @return Parent World
|
|
|
|
*/
|
|
|
|
World getWorld();
|
2011-02-02 00:01:33 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets a block from this chunk
|
2011-02-02 00:02:08 +01:00
|
|
|
*
|
2011-02-02 00:01:33 +01:00
|
|
|
* @param x 0-15
|
|
|
|
* @param y 0-127
|
|
|
|
* @param z 0-15
|
|
|
|
* @return the Block
|
|
|
|
*/
|
|
|
|
Block getBlock(int x, int y, int z);
|
2011-05-14 23:22:54 +02:00
|
|
|
|
2011-06-07 03:22:03 -04:00
|
|
|
/**
|
|
|
|
* Capture thread-safe read-only snapshot of chunk data
|
2011-12-25 16:02:30 +01:00
|
|
|
*
|
2011-06-07 03:22:03 -04:00
|
|
|
* @return ChunkSnapshot
|
|
|
|
*/
|
|
|
|
ChunkSnapshot getChunkSnapshot();
|
|
|
|
|
2011-06-17 09:21:56 -04:00
|
|
|
/**
|
|
|
|
* Capture thread-safe read-only snapshot of chunk data
|
2011-12-25 16:02:30 +01:00
|
|
|
*
|
2013-12-15 01:07:43 -05:00
|
|
|
* @param includeMaxblocky - if true, snapshot includes per-coordinate
|
|
|
|
* maximum Y values
|
|
|
|
* @param includeBiome - if true, snapshot includes per-coordinate biome
|
|
|
|
* type
|
|
|
|
* @param includeBiomeTempRain - if true, snapshot includes per-coordinate
|
|
|
|
* raw biome temperature and rainfall
|
2011-06-17 09:21:56 -04:00
|
|
|
* @return ChunkSnapshot
|
|
|
|
*/
|
|
|
|
ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain);
|
|
|
|
|
2011-09-25 02:56:40 +01:00
|
|
|
/**
|
|
|
|
* Get a list of all entities in the chunk.
|
2011-12-25 16:02:30 +01:00
|
|
|
*
|
2011-09-25 02:56:40 +01:00
|
|
|
* @return The entities.
|
|
|
|
*/
|
2011-03-07 14:06:15 -05:00
|
|
|
Entity[] getEntities();
|
2011-05-14 23:22:54 +02:00
|
|
|
|
2011-09-25 02:56:40 +01:00
|
|
|
/**
|
|
|
|
* Get a list of all tile entities in the chunk.
|
2011-12-25 16:02:30 +01:00
|
|
|
*
|
2011-09-25 02:56:40 +01:00
|
|
|
* @return The tile entities.
|
|
|
|
*/
|
2011-03-07 14:06:15 -05:00
|
|
|
BlockState[] getTileEntities();
|
2011-07-28 00:32:28 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if the chunk is loaded.
|
|
|
|
*
|
2011-09-25 02:56:40 +01:00
|
|
|
* @return True if it is loaded.
|
2011-07-28 00:32:28 -04:00
|
|
|
*/
|
|
|
|
boolean isLoaded();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Loads the chunk.
|
|
|
|
*
|
2013-12-15 01:07:43 -05:00
|
|
|
* @param generate Whether or not to generate a chunk if it doesn't
|
|
|
|
* already exist
|
2011-07-28 00:32:28 -04:00
|
|
|
* @return true if the chunk has loaded successfully, otherwise false
|
|
|
|
*/
|
|
|
|
boolean load(boolean generate);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Loads the chunk.
|
|
|
|
*
|
|
|
|
* @return true if the chunk has loaded successfully, otherwise false
|
|
|
|
*/
|
|
|
|
boolean load();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unloads and optionally saves the Chunk
|
|
|
|
*
|
|
|
|
* @param save Controls whether the chunk is saved
|
2013-12-15 01:07:43 -05:00
|
|
|
* @param safe Controls whether to unload the chunk when players are
|
|
|
|
* nearby
|
2011-07-28 00:32:28 -04:00
|
|
|
* @return true if the chunk has unloaded successfully, otherwise false
|
|
|
|
*/
|
|
|
|
boolean unload(boolean save, boolean safe);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unloads and optionally saves the Chunk
|
|
|
|
*
|
|
|
|
* @param save Controls whether the chunk is saved
|
|
|
|
* @return true if the chunk has unloaded successfully, otherwise false
|
|
|
|
*/
|
|
|
|
boolean unload(boolean save);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unloads and optionally saves the Chunk
|
|
|
|
*
|
|
|
|
* @return true if the chunk has unloaded successfully, otherwise false
|
|
|
|
*/
|
|
|
|
boolean unload();
|
2010-12-26 23:22:15 +00:00
|
|
|
}
|