Package net.minestom.server.instance
Class AnvilLoader
java.lang.Object
net.minestom.server.instance.AnvilLoader
- All Implemented Interfaces:
IChunkLoader
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@NotNull CompletableFuture
<@Nullable Chunk> Loads aChunk
, all blocks should be set since theChunkGenerator
is not applied.void
loadInstance
(@NotNull Instance instance) Loads instance data from the loader.@NotNull CompletableFuture
<Void> Saves aChunk
with an optional callback for when it is done.@NotNull CompletableFuture
<Void> saveInstance
(@NotNull Instance instance) boolean
Does thisIChunkLoader
allow for multi-threaded loading ofChunk
?boolean
Does thisIChunkLoader
allow for multi-threaded saving ofChunk
?void
unloadChunk
(Chunk chunk) Unload a given chunk.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minestom.server.instance.IChunkLoader
saveChunks
-
Constructor Details
-
AnvilLoader
-
AnvilLoader
-
-
Method Details
-
loadInstance
Description copied from interface:IChunkLoader
Loads instance data from the loader.- Specified by:
loadInstance
in interfaceIChunkLoader
- Parameters:
instance
- the instance to retrieve the data from
-
loadChunk
@NotNull public @NotNull CompletableFuture<@Nullable Chunk> loadChunk(@NotNull @NotNull Instance instance, int chunkX, int chunkZ) Description copied from interface:IChunkLoader
Loads aChunk
, all blocks should be set since theChunkGenerator
is not applied.- Specified by:
loadChunk
in interfaceIChunkLoader
- Parameters:
instance
- theInstance
where theChunk
belongchunkX
- the chunk XchunkZ
- the chunk Z- Returns:
- a
CompletableFuture
containing the chunk, or null if not present
-
saveInstance
- Specified by:
saveInstance
in interfaceIChunkLoader
-
saveChunk
Description copied from interface:IChunkLoader
Saves aChunk
with an optional callback for when it is done.- Specified by:
saveChunk
in interfaceIChunkLoader
- Parameters:
chunk
- theChunk
to save- Returns:
- a
CompletableFuture
executed when theChunk
is done saving, should be called even if the saving failed (you can throw an exception).
-
unloadChunk
Unload a given chunk. Also unloads a region when no chunk from that region is loaded.- Specified by:
unloadChunk
in interfaceIChunkLoader
- Parameters:
chunk
- the chunk to unload
-
supportsParallelLoading
public boolean supportsParallelLoading()Description copied from interface:IChunkLoader
Does thisIChunkLoader
allow for multi-threaded loading ofChunk
?- Specified by:
supportsParallelLoading
in interfaceIChunkLoader
- Returns:
- true if the chunk loader supports parallel loading
-
supportsParallelSaving
public boolean supportsParallelSaving()Description copied from interface:IChunkLoader
Does thisIChunkLoader
allow for multi-threaded saving ofChunk
?- Specified by:
supportsParallelSaving
in interfaceIChunkLoader
- Returns:
- true if the chunk loader supports parallel saving
-