Class World
-
Method Summary
Modifier and TypeMethodDescriptionstatic BiomegetBiome(int x, boolean endDimension)Gets the current biome for the specified coordinate and dimension.static BlockgetBlock(int x, int y, boolean endDimension)Gets the current block for the specified coordinate and dimension.static ChunkgetBlockChunk(int x, int y, boolean endDimension)Gets the chunk for the specified block coordinates and dimension.static ChunkgetChunk(int chunkX, boolean endDimension)Gets the chunk for the specified coordinate and dimension.static booleanGets if the end boss was defeatedgetLoadedChunks(boolean endDimension)Gets the loaded chunks for the specified dimension.static intGets the maximum height of the worldstatic intGets the minimum height of the worldstatic longgetSeed()Gets the seed of the worldstatic StringgetSign(int x, int y, boolean endDimension)Gets the sign text for the specified coordinate and dimension.static intgetSpawn()Gets the X position spawn point of the worldstatic doublegetTime()Gets the current world time in ticks.static booleaninBuildableArea(int x)Deprecated.Worlds are now infinite, this now always returns truestatic booleanisChunkLoaded(int chunkX, boolean endDimension)Gets if the chunk is loaded for the specified coordinate and dimension.static booleanGet if the current weather is rainstatic voidloadChunk(int chunkX, boolean endDimension)Loads the chunk for the specified coordinate and dimension.static voidsave()Saves the world to the diskstatic voidSets the current biome for the specified coordinate and dimension.static voidSets the current block for the specified coordinate and dimension.static voidsetEndBossDefeated(boolean defeated)Sets whether the end boss is defeatedstatic voidsetExitPortalActive(boolean active)Sets whether the exit portal in the end is activestatic voidsetRaining(boolean raining)Sets whether if it currently rainingstatic voidSets the sign text for the specified coordinate and dimension.static voidsetSpawn(int x)Sets the X position spawn point of the worldstatic voidsetTime(double ticks)Sets the world time in ticks.static voidunloadChunk(int chunkX, boolean endDimension)Unloads the chunk for the specified coordinate and dimension.
-
Method Details
-
getMaximumHeight
public static int getMaximumHeight()Gets the maximum height of the world- Returns:
- Maximum height in blocks
-
getMinimumHeight
public static int getMinimumHeight()Gets the minimum height of the world- Returns:
- Minimum height in blocks
-
inBuildableArea
Deprecated.Worlds are now infinite, this now always returns trueChecks if the position is in buildable area of the world.- Parameters:
x- X-coordinate of the world- Returns:
- Whether in buildable area
-
setBlock
Sets the current block for the specified coordinate and dimension.If the chunk containing the block is not loaded, it will be automatically loaded when calling this.
- Parameters:
x- X-coordinate of this blocky- Y-coordinate of this blockendDimension- Dimension of this block (false = Overworld, true = End)block- Block type to set- Throws:
IllegalArgumentException- if block position is outside world height boundsIllegalArgumentException- if block is null
-
getBlock
Gets the current block for the specified coordinate and dimension.If the chunk containing the block is not loaded, it will be automatically loaded when calling this.
- Parameters:
x- X-coordinate of this blocky- Y-coordinate of this blockendDimension- Dimension of this block (false = Overworld, true = End)- Returns:
- Block type for this position
- Throws:
IllegalArgumentException- if block position is outside world height bounds
-
setSign
Sets the sign text for the specified coordinate and dimension.If the chunk containing the sign is not loaded, it will be automatically loaded when calling this.
- Parameters:
x- X-coordinate of this signy- Y-coordinate of this signendDimension- Dimension of this sign (false = Overworld, true = End)message- Sign message to set- Throws:
IllegalArgumentException- if the block is not a signIllegalArgumentException- if block position is outside world height boundsIllegalArgumentException- if message is null
-
getSign
Gets the sign text for the specified coordinate and dimension.If the chunk containing the sign is not loaded, it will be automatically loaded when calling this.
- Parameters:
x- X-coordinate of this signy- Y-coordinate of this signendDimension- Dimension of this sign (false = Overworld, true = End)- Returns:
- Sign message on this sign
- Throws:
IllegalArgumentException- if the block is not a signIllegalArgumentException- if block position is outside world height bounds
-
setBiome
Sets the current biome for the specified coordinate and dimension.Biomes changes only update after a players chunk reloads.
If the chunk containing the biome is not loaded, it will be automatically loaded when calling this.
- Parameters:
x- X-coordinate of this biomeendDimension- Dimension of this biome (false = Overworld, true = End)biome- Biome type to set- Throws:
IllegalArgumentException- if biome is null
-
getBiome
Gets the current biome for the specified coordinate and dimension.If the chunk containing the biome is not loaded, it will be automatically loaded when calling this.
- Parameters:
x- X-coordinate of this blockendDimension- Dimension of this biome (false = Overworld, true = End)- Returns:
- Biome type for this position
-
getLoadedChunks
Gets the loaded chunks for the specified dimension.- Parameters:
endDimension- Dimension of the chunks (false = Overworld, true = End)- Returns:
- Array list of chunks
-
isChunkLoaded
public static boolean isChunkLoaded(int chunkX, boolean endDimension)Gets if the chunk is loaded for the specified coordinate and dimension.- Parameters:
chunkX- X-coordinate of the chunkendDimension- Dimension of the chunk (false = Overworld, true = End)- Returns:
- Whether chunk is loaded
-
getChunk
Gets the chunk for the specified coordinate and dimension.- Parameters:
chunkX- X-coordinate of the chunkendDimension- Dimension of the chunk (false = Overworld, true = End)- Returns:
- Chunk instance
-
getBlockChunk
Gets the chunk for the specified block coordinates and dimension.- Parameters:
x- Block X-coordinatey- Block Y-coordinateendDimension- Dimension of the chunk (false = Overworld, true = End)- Returns:
- Chunk instance
- Throws:
IllegalArgumentException- if block position is outside world height bounds
-
loadChunk
public static void loadChunk(int chunkX, boolean endDimension)Loads the chunk for the specified coordinate and dimension.The chunk will remain always loaded until unloaded by a plugin
- Parameters:
chunkX- X-coordinate of the chunkendDimension- Dimension of the chunk (false = Overworld, true = End)
-
unloadChunk
public static void unloadChunk(int chunkX, boolean endDimension)Unloads the chunk for the specified coordinate and dimension.- Parameters:
chunkX- X-coordinate of the chunkendDimension- Dimension of the chunk (false = Overworld, true = End)- Throws:
IllegalStateException- if chunk is not loaded
-
setRaining
public static void setRaining(boolean raining)Sets whether if it currently raining- Parameters:
raining- Whether it is raining
-
isRaining
public static boolean isRaining()Get if the current weather is rain- Returns:
- Whether it is raining
-
setTime
public static void setTime(double ticks)Sets the world time in ticks.- Parameters:
ticks- Time in ticks
-
getTime
public static double getTime()Gets the current world time in ticks.- Returns:
- Time in ticks
-
getSeed
public static long getSeed()Gets the seed of the world- Returns:
- World seed
-
getEndBossDefeated
public static boolean getEndBossDefeated()Gets if the end boss was defeated- Returns:
- Whether defeated
-
setEndBossDefeated
public static void setEndBossDefeated(boolean defeated)Sets whether the end boss is defeated- Parameters:
defeated- Whether defeated
-
getSpawn
public static int getSpawn()Gets the X position spawn point of the world- Returns:
- World spawn point
-
setSpawn
public static void setSpawn(int x)Sets the X position spawn point of the world- Parameters:
x- Spawn X-coordinate
-
setExitPortalActive
public static void setExitPortalActive(boolean active)Sets whether the exit portal in the end is activeIf the chunk containing the exit portal is not loaded, it will be automatically loaded when calling this.
- Parameters:
active- Whether active
-
save
public static void save()Saves the world to the disk
-