Class AnvilLoader
- All Implemented Interfaces:
ChunkLoader
-
Constructor Summary
ConstructorsConstructorDescriptionAnvilLoader(String path) Deprecated, for removal: This API element is subject to removal in a future version.This creates the AnvilLoader for worlds created before 26.1.AnvilLoader(Path path) Deprecated, for removal: This API element is subject to removal in a future version.This creates the AnvilLoader for worlds created before 26.1.AnvilLoader(Path path, Key dimension) Creates a new AnvilLoader for the given world path and dimension. -
Method Summary
Modifier and TypeMethodDescriptionvoidloadInstance(Instance instance) Loads instance data from the loader.voidSaves aChunkwith an optional callback for when it is done.voidsaveInstance(Instance instance) booleanSupports for instance/chunk loading in virtual threads.booleanSupports for instance/chunk saving in virtual threads.voidunloadChunk(Chunk chunk) Unload a given chunk.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ChunkLoader
saveChunks
-
Constructor Details
-
AnvilLoader
Creates a new AnvilLoader for the given world path and dimension.- Parameters:
path- The path to the worlddimension- The key for the dimension. UseDimensionTypefor getting vanilla keys for dimensions.
-
AnvilLoader
Deprecated, for removal: This API element is subject to removal in a future version.This creates the AnvilLoader for worlds created before 26.1. UseAnvilLoader(Path, Key)instead.- Parameters:
path- The path to the world
-
AnvilLoader
Deprecated, for removal: This API element is subject to removal in a future version.This creates the AnvilLoader for worlds created before 26.1. UseAnvilLoader(Path, Key)instead.- Parameters:
path- The path to the world
-
-
Method Details
-
loadInstance
Description copied from interface:ChunkLoaderLoads instance data from the loader.- Specified by:
loadInstancein interfaceChunkLoader- Parameters:
instance- the instance to retrieve the data from
-
loadChunk
Description copied from interface:ChunkLoaderLoads aChunk, all blocks should be set since theGeneratoris not applied.Implementations must not initiate another chunk load on the same
Instancefrom this method. Doing so re-enters the instance's loading registry and may fail with anIllegalStateException. If loading a chunk requires data associated with neighboring chunks, read that data directly from the backing storage instead of callingInstance.loadChunk(int, int)orInstance.loadOptionalChunk(int, int).A loader must never wait for the same chunk it is currently loading. Requests for an in-progress chunk share the existing future, so waiting for that future from this method would wait for the current invocation.
- Specified by:
loadChunkin interfaceChunkLoader- Parameters:
instance- theInstancewhere theChunkbelongchunkX- the chunk XchunkZ- the chunk Z- Returns:
- the chunk, or null if not present
-
saveInstance
- Specified by:
saveInstancein interfaceChunkLoader
-
saveChunk
Description copied from interface:ChunkLoaderSaves aChunkwith an optional callback for when it is done.- Specified by:
saveChunkin interfaceChunkLoader- Parameters:
chunk- theChunkto save
-
unloadChunk
Unload a given chunk. Also unloads a region when no chunk from that region is loaded.- Specified by:
unloadChunkin interfaceChunkLoader- Parameters:
chunk- the chunk to unload
-
supportsParallelLoading
public boolean supportsParallelLoading()Description copied from interface:ChunkLoaderSupports for instance/chunk loading in virtual threads.When true, chunks may load in parallel on virtual threads. When false,
ChunkLoader.loadChunk(Instance, int, int)runs synchronously on the thread requesting the load. The re-entrant loading restrictions documented onChunkLoader.loadChunk(Instance, int, int)apply in either case.- Specified by:
supportsParallelLoadingin interfaceChunkLoader- Returns:
- true if the chunk loader supports parallel loading
-
supportsParallelSaving
public boolean supportsParallelSaving()Description copied from interface:ChunkLoaderSupports for instance/chunk saving in virtual threads.- Specified by:
supportsParallelSavingin interfaceChunkLoader- Returns:
- true if the chunk loader supports parallel saving
-