Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
Chunk.java
1 package org.bukkit;
2 
3 import org.bukkit.block.Block;
5 import org.bukkit.entity.Entity;
6 
7 /**
8  * Represents a chunk of blocks
9  */
10 public 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  */
49 
50  /**
51  * Capture thread-safe read-only snapshot of chunk data
52  *
53  * @param includeMaxblocky - if true, snapshot includes per-coordinate
54  * maximum Y values
55  * @param includeBiome - if true, snapshot includes per-coordinate biome
56  * type
57  * @param includeBiomeTempRain - if true, snapshot includes per-coordinate
58  * raw biome temperature and rainfall
59  * @return ChunkSnapshot
60  */
61  ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain);
62 
63  /**
64  * Get a list of all entities in the chunk.
65  *
66  * @return The entities.
67  */
68  Entity[] getEntities();
69 
70  /**
71  * Get a list of all tile entities in the chunk.
72  *
73  * @return The tile entities.
74  */
76 
77  /**
78  * Checks if the chunk is loaded.
79  *
80  * @return True if it is loaded.
81  */
82  boolean isLoaded();
83 
84  /**
85  * Loads the chunk.
86  *
87  * @param generate Whether or not to generate a chunk if it doesn't
88  * already exist
89  * @return true if the chunk has loaded successfully, otherwise false
90  */
91  boolean load(boolean generate);
92 
93  /**
94  * Loads the chunk.
95  *
96  * @return true if the chunk has loaded successfully, otherwise false
97  */
98  boolean load();
99 
100  /**
101  * Unloads and optionally saves the Chunk
102  *
103  * @param save Controls whether the chunk is saved
104  * @param safe Controls whether to unload the chunk when players are
105  * nearby
106  * @return true if the chunk has unloaded successfully, otherwise false
107  */
108  boolean unload(boolean save, boolean safe);
109 
110  /**
111  * Unloads and optionally saves the Chunk
112  *
113  * @param save Controls whether the chunk is saved
114  * @return true if the chunk has unloaded successfully, otherwise false
115  */
116  boolean unload(boolean save);
117 
118  /**
119  * Unloads and optionally saves the Chunk
120  *
121  * @return true if the chunk has unloaded successfully, otherwise false
122  */
123  boolean unload();
124 }
ChunkSnapshot getChunkSnapshot()
boolean load()
Entity[] getEntities()
BlockState[] getTileEntities()
boolean isLoaded()
boolean unload()
Block getBlock(int x, int y, int z)