public interface WorldStorage
World
.
It should be noted that this can have direct access to the underlying storage system of the world and interface with deleting and modifying chunks.
Modifier and Type | Method and Description |
---|---|
CompletableFuture<Boolean> |
doesChunkExist(com.flowpowered.math.vector.Vector3i chunkCoords)
Checks if the given chunk coordinates represented by
Vector3i
exist in the world. |
CompletableFuture<Optional<DataContainer>> |
getChunkData(com.flowpowered.math.vector.Vector3i chunkCoords)
Gets a
DataContainer including all data related to a
Chunk . |
ChunkDataStream |
getGeneratedChunks()
Gets a
ChunkDataStream . |
WorldProperties |
getWorldProperties()
Gets the
WorldProperties of this storage. |
ChunkDataStream getGeneratedChunks()
ChunkDataStream
.
Usage of a ChunkDataStream
should be limited to asynchronous
tasks to avoid hanging the main thread.
CompletableFuture<Boolean> doesChunkExist(com.flowpowered.math.vector.Vector3i chunkCoords)
Vector3i
exist in the world.
Note that this is an asynchronous check as the storage of chunks can not be guaranteed to remain in sync with the server, let alone on the server thread.
It is imperative to understand that the CompletableFuture
task
is blocking, and should avoid using CompletableFuture.get()
while
on the main thread.
chunkCoords
- The chunk coordinatesCompletableFuture<Optional<DataContainer>> getChunkData(com.flowpowered.math.vector.Vector3i chunkCoords)
DataContainer
including all data related to a
Chunk
.
The container is a read only instance of the data, and therefor should not be considered as mutable data. Changes are NOT saved, and the data may not be in sync with the server if the chunk is currently loaded.
This may not return a DataContainer
in the event there is no
chunk data generated at the desired coordinates.
It is imperative to understand that the CompletableFuture
task
is blocking, and should avoid using CompletableFuture.get()
while
on the main thread.
chunkCoords
- The chunk coordinatesWorldProperties getWorldProperties()
WorldProperties
of this storage. In the vanilla storage
medium this represents the data available in the level.dat file.