Package com.welcome234.pluginsystem
Class Chunk
java.lang.Object
com.welcome234.pluginsystem.Chunk
Represents a world chunk
-
Method Summary
Modifier and TypeMethodDescriptiongetBiome(int x)Gets the current biome for the specified chunk coordinates.getBlock(int x, int y)Gets the current block for the specified chunk coordinates.Gets all alive and loaded entities in this chunk.getSign(int x, int y)Gets the sign text for the specified chunk coordinates.intgetX()Gets the current X-coordinate of this chunkbooleanisInEnd()Gets whether the chunk is in the end dimensionbooleanisLoaded()Gets if the chunk is loadedbooleanGets whether this chunk is loaded by a playervoidload()Loads the chunkvoidSets the current biome for the specified chunk coordinates.voidSets the current block for the specified chunk coordinates.voidSets the sign text for the specified chunk coordinates.voidunload()Unloads the chunk
-
Method Details
-
isLoaded
public boolean isLoaded()Gets if the chunk is loaded- Returns:
- Whether chunk is loaded
-
isPlayerLoaded
public boolean isPlayerLoaded()Gets whether this chunk is loaded by a player- Returns:
- Whether player loaded
- Throws:
IllegalStateException- if chunk is not loaded
-
getX
public int getX()Gets the current X-coordinate of this chunk- Returns:
- X-coordinate position
-
isInEnd
public boolean isInEnd()Gets whether the chunk is in the end dimension- Returns:
- Whether in end dimension
-
setBlock
Sets the current block for the specified chunk coordinates.- Parameters:
x- Chunk X-coordinate of this blocky- Chunk Y-coordinate of this blockblock- Block type to set- Throws:
IllegalArgumentException- if block position is outside chunk boundsIllegalStateException- if chunk is not loadedIllegalArgumentException- if block is null
-
getBlock
Gets the current block for the specified chunk coordinates.- Parameters:
x- Chunk X-coordinate of this blocky- Chunk Y-coordinate of this block- Returns:
- Block type for this position
- Throws:
IllegalArgumentException- if block position is outside chunk boundsIllegalStateException- if chunk is not loaded
-
setSign
Sets the sign text for the specified chunk coordinates.- Parameters:
x- Chunk X-coordinate of this signy- Chunk Y-coordinate of this signmessage- Sign message to set- Throws:
IllegalArgumentException- if the block is not a signIllegalArgumentException- if block position is outside chunk boundsIllegalStateException- if chunk is not loadedIllegalArgumentException- if message is null
-
getSign
Gets the sign text for the specified chunk coordinates.- Parameters:
x- Chunk X-coordinate of this signy- Chunk Y-coordinate of this sign- Returns:
- Sign message on this sign
- Throws:
IllegalArgumentException- if the block is not a signIllegalArgumentException- if block position is outside chunk boundsIllegalStateException- if chunk is not loaded
-
setBiome
Sets the current biome for the specified chunk coordinates.Biomes changes only update after a players chunk reloads.
- Parameters:
x- Chunk X-coordinate of this biomebiome- Biome type to set- Throws:
IllegalArgumentException- if block position is outside chunk boundsIllegalStateException- if chunk is not loadedIllegalArgumentException- if biome is null
-
getBiome
Gets the current biome for the specified chunk coordinates.- Parameters:
x- Chunk X-coordinate of this block- Returns:
- Biome type for this position
- Throws:
IllegalArgumentException- if block position is outside chunk boundsIllegalStateException- if chunk is not loaded
-
getEntities
Gets all alive and loaded entities in this chunk.- Returns:
- Array list of loaded entities
- Throws:
IllegalStateException- if chunk is not loaded
-
load
public void load()Loads the chunkThe chunk will remain always loaded until unloaded by a plugin
-
unload
public void unload()Unloads the chunk- Throws:
IllegalStateException- if chunk is not loaded
-