Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 109 lines 2.7 kB view raw
1package org.bukkit; 2 3import org.bukkit.block.Block; 4import org.bukkit.block.BlockState; 5import org.bukkit.entity.Entity; 6 7/** 8 * Represents a chunk of blocks 9 */ 10public interface Chunk { 11 12 /** 13 * Gets the X-coordinate of this chunk 14 * 15 * @return X-coordinate 16 */ 17 int getX(); 18 19 /** 20 * Gets the Z-coordinate of this chunk 21 * 22 * @return Z-coordinate 23 */ 24 int getZ(); 25 26 /** 27 * Gets the world containing this chunk 28 * 29 * @return Parent World 30 */ 31 World getWorld(); 32 33 /** 34 * Gets a block from this chunk 35 * 36 * @param x 0-15 37 * @param y 0-127 38 * @param z 0-15 39 * @return the Block 40 */ 41 Block getBlock(int x, int y, int z); 42 43 /** 44 * Capture thread-safe read-only snapshot of chunk data 45 * 46 * @return ChunkSnapshot 47 */ 48 ChunkSnapshot getChunkSnapshot(); 49 50 /** 51 * Capture thread-safe read-only snapshot of chunk data 52 * 53 * @param includeMaxblocky - if true, snapshot includes per-coordinate maximum Y values 54 * @param includeBiome - if true, snapshot includes per-coordinate biome type 55 * @param includeBiomeTempRain - if true, snapshot includes per-coordinate raw biome temperature and rainfall 56 * @return ChunkSnapshot 57 */ 58 ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain); 59 60 Entity[] getEntities(); 61 62 BlockState[] getTileEntities(); 63 64 /** 65 * Checks if the chunk is loaded. 66 * 67 * @return 68 */ 69 boolean isLoaded(); 70 71 /** 72 * Loads the chunk. 73 * 74 * @param generate Whether or not to generate a chunk if it doesn't already exist 75 * @return true if the chunk has loaded successfully, otherwise false 76 */ 77 boolean load(boolean generate); 78 79 /** 80 * Loads the chunk. 81 * 82 * @return true if the chunk has loaded successfully, otherwise false 83 */ 84 boolean load(); 85 86 /** 87 * Unloads and optionally saves the Chunk 88 * 89 * @param save Controls whether the chunk is saved 90 * @param safe Controls whether to unload the chunk when players are nearby 91 * @return true if the chunk has unloaded successfully, otherwise false 92 */ 93 boolean unload(boolean save, boolean safe); 94 95 /** 96 * Unloads and optionally saves the Chunk 97 * 98 * @param save Controls whether the chunk is saved 99 * @return true if the chunk has unloaded successfully, otherwise false 100 */ 101 boolean unload(boolean save); 102 103 /** 104 * Unloads and optionally saves the Chunk 105 * 106 * @return true if the chunk has unloaded successfully, otherwise false 107 */ 108 boolean unload(); 109}