public interface World extends Extent, WeatherUniverse, Viewer, ContextSource, MessageReceiver, ChatTypeMessageReceiver
EntityUniverse.EntityHit
Modifier and Type | Method and Description |
---|---|
default boolean |
doesKeepSpawnLoaded()
Gets whether the spawn chunks should remain loaded.
|
MutableBiomeVolumeWorker<World> |
getBiomeWorker()
Gets a new biome worker for this biome volume.
|
MutableBlockVolumeWorker<World> |
getBlockWorker()
Gets a new block worker for this block volume.
|
Optional<Chunk> |
getChunk(int cx,
int cy,
int cz)
Gets the loaded chunk at the given chunk coordinate position.
|
default Optional<Chunk> |
getChunk(com.flowpowered.math.vector.Vector3i chunkPosition)
Gets the loaded chunk at the given chunk coordinate position.
|
default Optional<Chunk> |
getChunkAtBlock(int bx,
int by,
int bz)
Gets the loaded chunk at the given block coordinate position.
|
default Optional<Chunk> |
getChunkAtBlock(com.flowpowered.math.vector.Vector3i blockPosition)
Gets the loaded chunk at the given block coordinate position.
|
default Difficulty |
getDifficulty()
Gets the current
Difficulty . |
Dimension |
getDimension()
Returns the
Dimension of this world. |
Path |
getDirectory()
Gets the
Path pointing to the root of where the world's data
is being stored. |
Optional<Entity> |
getEntity(UUID uuid)
Gets the entity whose
UUID matches the provided id, possibly
returning no entity if the entity is not loaded or non-existent. |
default Optional<String> |
getGameRule(String gameRule)
Gets a set game rule's current value, if available and set.
|
default Map<String,String> |
getGameRules()
Gets the current
map of game rules and their
values. |
Iterable<Chunk> |
getLoadedChunks()
Returns a Collection of all actively loaded chunks in this world.
|
default LocatableBlock |
getLocatableBlock(int x,
int y,
int z)
Gets a
LocatableBlock for the desired x, y, z coordinates. |
default LocatableBlock |
getLocatableBlock(com.flowpowered.math.vector.Vector3i position)
Gets a
LocatableBlock for the desired Vector3i position. |
default Location<World> |
getLocation(double x,
double y,
double z)
Gets a location in this extent at the given position.
|
default Location<World> |
getLocation(int x,
int y,
int z)
Gets a location in this extent at the given position.
|
default Location<World> |
getLocation(com.flowpowered.math.vector.Vector3d position)
Gets a location in this extent at the given position.
|
default Location<World> |
getLocation(com.flowpowered.math.vector.Vector3i position)
Gets a location in this extent at the given position.
|
default String |
getName()
Gets the name of this
world . |
Collection<Player> |
getPlayers()
Gets an unmodifiable collection of
Player s currently in this world. |
PortalAgent |
getPortalAgent()
Gets the portal agent, used for manipulating teleporters.
|
WorldProperties |
getProperties()
Gets the properties for this world.
|
int |
getSeaLevel()
Gets the sea level of the world.
|
default SerializationBehavior |
getSerializationBehavior()
Gets the
SerializationBehavior to use. |
default Location<World> |
getSpawnLocation()
Gets the
Location of the spawn point. |
default UUID |
getUniqueId()
|
int |
getViewDistance()
Gets the view distance (in chunks) for this world.
|
WorldBorder |
getWorldBorder()
Gets the world border for the world.
|
WorldGenerator |
getWorldGenerator()
Gets the
WorldGenerator for this world. |
WorldStorage |
getWorldStorage()
Gets the associated
WorldStorage persisting this world. |
Optional<Chunk> |
loadChunk(int cx,
int cy,
int cz,
boolean shouldGenerate)
Gets the chunk at the given chunk coordinate position if it exists or if
shouldGenerate is true and the chunk is generated. |
default Optional<Chunk> |
loadChunk(com.flowpowered.math.vector.Vector3i chunkPosition,
boolean shouldGenerate)
Gets the chunk at the given chunk coordinate position if it exists or if
shouldGenerate is true and the chunk is generated. |
default CompletableFuture<Optional<Chunk>> |
loadChunkAsync(int cx,
int cy,
int cz,
boolean shouldGenerate)
Gets the chunk at the given chunk coordinate position if it exists or if
shouldGenerate is true and the chunk is generated. |
default CompletableFuture<Optional<Chunk>> |
loadChunkAsync(com.flowpowered.math.vector.Vector3i chunkPosition,
boolean shouldGenerate)
Gets the chunk at the given chunk coordinate position if it exists or if
shouldGenerate is true and the chunk is generated. |
ChunkPreGenerate.Builder |
newChunkPreGenerate(com.flowpowered.math.vector.Vector3d center,
double diameter)
Returns a new builder for creating a task to pre-generate the chunks
inside a square border with a given center and diameter.
|
default Optional<Chunk> |
regenerateChunk(int cx,
int cy,
int cz)
Regenerates a chunk at the given chunk coordinates.
|
Optional<Chunk> |
regenerateChunk(int cx,
int cy,
int cz,
ChunkRegenerateFlag flag)
Regenerates a chunk at the given chunk coordinates.
|
default Optional<Chunk> |
regenerateChunk(com.flowpowered.math.vector.Vector3i chunkPosition)
Regenerates a chunk at the given chunk coordinate position.
|
default Optional<Chunk> |
regenerateChunk(com.flowpowered.math.vector.Vector3i chunkPosition,
ChunkRegenerateFlag flag)
Regenerates a chunk at the given chunk coordinate position.
|
void |
resetViewDistance()
Resets the view distance to the default value for this world.
|
boolean |
save()
Instructs the world to save all data.
|
default void |
setKeepSpawnLoaded(boolean keepLoaded)
Sets whether the spawn chunks should remain loaded.
|
default void |
setSerializationBehavior(SerializationBehavior behavior)
Sets the
SerializationBehavior for use. |
void |
setViewDistance(int viewDistance)
Sets the view distance (in chunks) for this world.
|
void |
triggerExplosion(Explosion explosion)
Causes an
Explosion in a world. |
boolean |
unloadChunk(Chunk chunk)
Unloads the given chunk from the world.
|
addScheduledUpdate, addScheduledUpdate, createArchetypeVolume, createSnapshot, createSnapshot, getBlockSelectionBox, getBlockSelectionBox, getCreator, getCreator, getExtentView, getHighestPositionAt, getHighestYAt, getHighestYAt, getIntersectingBlockCollisionBoxes, getIntersectingCollisionBoxes, getIntersectingCollisionBoxes, getNotifier, getNotifier, getPrecipitationLevelAt, getPrecipitationLevelAt, getPrecipitationLevelAt, getScheduledUpdates, getScheduledUpdates, isLoaded, removeScheduledUpdate, removeScheduledUpdate, restoreSnapshot, restoreSnapshot, restoreSnapshot, setBlock, setBlock, setBlockType, setBlockType, setCreator, setCreator, setNotifier, setNotifier
createEntity, createEntity, createEntity, createEntity, createEntityNaturally, createEntityNaturally, getEntities, getEntities, getIntersectingEntities, getIntersectingEntities, getIntersectingEntities, getIntersectingEntities, getIntersectingEntities, getIntersectingEntities, getIntersectingEntities, getIntersectingEntities, getNearbyEntities, restoreSnapshot, spawnEntities, spawnEntity
getTileEntities, getTileEntities, getTileEntity, getTileEntity
digBlock, digBlock, digBlockWith, digBlockWith, getBlockDigTimeWith, getBlockDigTimeWith, hitBlock, hitBlock, interactBlock, interactBlock, interactBlockWith, interactBlockWith, placeBlock, placeBlock
getBlockView, getBlockView, getRelativeBlockView, setBlock, setBlock, setBlockType, setBlockType
containsBlock, containsBlock, getBlock, getBlock, getBlockCopy, getBlockCopy, getBlockMax, getBlockMin, getBlockSize, getBlockType, getBlockType, getImmutableBlockCopy, getUnmodifiableBlockView
getBiomeView, getBiomeView, getRelativeBiomeView, setBiome, setBiome
containsBiome, containsBiome, getBiome, getBiome, getBiomeCopy, getBiomeCopy, getBiomeMax, getBiomeMin, getBiomeSize, getImmutableBiomeCopy, getUnmodifiableBiomeView
copyFrom, copyFrom, copyFrom, copyFrom, copyFrom, copyFrom, copyFrom, copyFrom, get, get, get, get, getKeys, getKeys, getManipulators, getManipulators, getOrCreate, getOrCreate, getOrElse, getOrElse, getOrNull, getOrNull, getValue, getValue, getValues, getValues, offer, offer, offer, offer, offer, offer, offer, offer, offer, offer, offer, remove, remove, remove, remove, setRawData, setRawData, supports, supports, supports, supports, supports, supports, supports, supports, transform, transform, undo, undo, validateRawData, validateRawData
getFacesWithProperty, getFacesWithProperty, getProperties, getProperties, getProperty, getProperty, getProperty, getProperty
getRemainingDuration, getRunningDuration, getWeather, setWeather, setWeather
clearTitle, playRecord, playSound, playSound, playSound, playSound, playSound, playSound, resetBlockChange, resetBlockChange, resetTitle, sendBlockChange, sendBlockChange, sendBookView, sendTitle, spawnParticles, spawnParticles, stopRecord, stopSounds, stopSounds, stopSounds, stopSounds
getContext
getMessageChannel, sendMessage, sendMessage, sendMessage, sendMessages, sendMessages, setMessageChannel
sendMessage, sendMessage, sendMessage, sendMessages, sendMessages
Collection<Player> getPlayers()
Player
s currently in this world.default Location<World> getLocation(com.flowpowered.math.vector.Vector3i position)
Extent
getLocation
in interface Extent
position
- The positiondefault Location<World> getLocation(int x, int y, int z)
Extent
getLocation
in interface Extent
x
- The X positiony
- The Y positionz
- The Z positiondefault Location<World> getLocation(com.flowpowered.math.vector.Vector3d position)
Extent
getLocation
in interface Extent
position
- The positiondefault Location<World> getLocation(double x, double y, double z)
Extent
getLocation
in interface Extent
x
- The X positiony
- The Y positionz
- The Z positiondefault LocatableBlock getLocatableBlock(com.flowpowered.math.vector.Vector3i position)
LocatableBlock
for the desired Vector3i
position.position
- The position to get the locatable blockdefault LocatableBlock getLocatableBlock(int x, int y, int z)
LocatableBlock
for the desired x, y, z
coordinates.x
- The x positiony
- The y positionz
- The z positiondefault Optional<Chunk> getChunkAtBlock(com.flowpowered.math.vector.Vector3i blockPosition)
blockPosition
- The positiondefault Optional<Chunk> getChunkAtBlock(int bx, int by, int bz)
bx
- The x coordinateby
- The y coordinatebz
- The z coordinatedefault Optional<Chunk> getChunk(com.flowpowered.math.vector.Vector3i chunkPosition)
chunkPosition
- The positionOptional<Chunk> getChunk(int cx, int cy, int cz)
In Vanilla, the y coordinate will always be 0.
cx
- The x coordinatecy
- The y coordinatecz
- The z coordinatedefault Optional<Chunk> loadChunk(com.flowpowered.math.vector.Vector3i chunkPosition, boolean shouldGenerate)
shouldGenerate
is true and the chunk is generated.chunkPosition
- The positionshouldGenerate
- True to generate a new chunkOptional<Chunk> loadChunk(int cx, int cy, int cz, boolean shouldGenerate)
shouldGenerate
is true and the chunk is generated.
In Vanilla, the y coordinate will always be 0.
cx
- The x coordinatecy
- The y coordinatecz
- The z coordinateshouldGenerate
- True to generate a new chunkdefault CompletableFuture<Optional<Chunk>> loadChunkAsync(com.flowpowered.math.vector.Vector3i chunkPosition, boolean shouldGenerate)
shouldGenerate
is true and the chunk is generated.
Unlike loadChunk(Vector3i, boolean)
this method allows the
implementation to load the chunk asynchronously without blocking the
main server thread. The Future
will be called with the chunk once
the operation was completed.
Note: If asynchronous chunk loading is not supported by
the implementation, the chunk will be loaded synchronously and the
Future
will be called immediately.
chunkPosition
- The positionshouldGenerate
- True to generate a new chunkdefault CompletableFuture<Optional<Chunk>> loadChunkAsync(int cx, int cy, int cz, boolean shouldGenerate)
shouldGenerate
is true and the chunk is generated.
Unlike loadChunk(Vector3i, boolean)
this method allows the
implementation to load the chunk asynchronously without blocking the
main server thread. The Future
will be called with the chunk once
the operation was completed.
Note: If asynchronous chunk loading is not supported by
the implementation, the chunk will be loaded synchronously and the
Future
will be called immediately.
cx
- The x coordinatecy
- The y coordinatecz
- The z coordinateshouldGenerate
- True to generate a new chunkdefault Optional<Chunk> regenerateChunk(com.flowpowered.math.vector.Vector3i chunkPosition)
chunkPosition
- The chunk position to regeneratedefault Optional<Chunk> regenerateChunk(int cx, int cy, int cz)
cx
- The chunk x coordinatecy
- The chunk y coordinatecz
- The chunk z coordinatedefault Optional<Chunk> regenerateChunk(com.flowpowered.math.vector.Vector3i chunkPosition, ChunkRegenerateFlag flag)
chunkPosition
- The chunk position to regenerateflag
- The chunk regenerate flag to useOptional<Chunk> regenerateChunk(int cx, int cy, int cz, ChunkRegenerateFlag flag)
cx
- The chunk x coordinatecy
- The chunk y coordinatecz
- The chunk z coordinateflag
- The chunk regenerate flag to useboolean unloadChunk(Chunk chunk)
boolean
flag
for whether the operation was successful.chunk
- The chunk to unloadIterable<Chunk> getLoadedChunks()
The ordering of the returned chunks is undefined.
Optional<Entity> getEntity(UUID uuid)
UUID
matches the provided id, possibly
returning no entity if the entity is not loaded or non-existent.
For world implementations, only some parts of the world is usually loaded, so this method may return no entity if the entity is not loaded.
getEntity
in interface EntityUniverse
uuid
- The unique idWorldBorder getWorldBorder()
ChunkPreGenerate.Builder newChunkPreGenerate(com.flowpowered.math.vector.Vector3d center, double diameter)
center
- The center of the borderdiameter
- The diameter of the borderChunkPreGenerate
WorldGenerator getWorldGenerator()
WorldGenerator
for this world.
Any changes made to the world generator will only affect newly generated chunks.
WorldProperties getProperties()
Path getDirectory()
Path
pointing to the root of where the world's data
is being stored.default UUID getUniqueId()
getUniqueId
in interface Identifiable
WorldProperties.getUniqueId()
default String getName()
world
.WorldProperties.getWorldName()
default Difficulty getDifficulty()
Difficulty
.WorldProperties.getDifficulty()
default Optional<String> getGameRule(String gameRule)
gameRule
- The game ruleWorldProperties.getGameRule(String)
default Map<String,String> getGameRules()
map
of game rules and their
values. Most game rules can be found in DefaultGameRules
.WorldProperties.getGameRules()
default boolean doesKeepSpawnLoaded()
WorldProperties.doesKeepSpawnLoaded()
default void setKeepSpawnLoaded(boolean keepLoaded)
keepLoaded
- Whether to keep spawn loadedWorldProperties.setKeepSpawnLoaded(boolean)
default Location<World> getSpawnLocation()
Location
of the spawn point.default SerializationBehavior getSerializationBehavior()
SerializationBehavior
to use.WorldProperties.getSerializationBehavior()
default void setSerializationBehavior(SerializationBehavior behavior)
SerializationBehavior
for use.behavior
- The serialization behavior to setWorldProperties.setSerializationBehavior(SerializationBehavior)
WorldStorage getWorldStorage()
WorldStorage
persisting this world.void triggerExplosion(Explosion explosion)
Explosion
in a world.explosion
- The explosion to causePortalAgent getPortalAgent()
int getSeaLevel()
MutableBiomeVolumeWorker<World> getBiomeWorker()
BiomeVolume
getBiomeWorker
in interface BiomeVolume
getBiomeWorker
in interface Extent
getBiomeWorker
in interface MutableBiomeVolume
MutableBlockVolumeWorker<World> getBlockWorker()
BlockVolume
getBlockWorker
in interface BlockVolume
getBlockWorker
in interface Extent
getBlockWorker
in interface InteractableVolume
getBlockWorker
in interface MutableBlockVolume
getBlockWorker
in interface TileEntityVolume
boolean save() throws IOException
SerializationBehavior
is SerializationBehaviors.NONE
IOException
- If the save failedint getViewDistance()
void setViewDistance(int viewDistance)
The view distance must be greater than or equal to 3, and less than or equal to 32.
viewDistance
- The view distancevoid resetViewDistance()