Class EngineLevels
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.resources.ResourceKey<net.minecraft.world.level.dimension.DimensionType> static final org.apache.logging.log4j.Logger -
Method Summary
Modifier and TypeMethodDescriptionvoidenqueueLevelDeletion(net.minecraft.server.level.ServerLevel level) voidenqueueLevelUnloading(net.minecraft.server.level.ServerLevel level) static EngineLevelsget(net.minecraft.server.MinecraftServer server) Gets theEngineLevelsinstance for the given server instance.getOrOpenPersistentLevel(net.minecraft.resources.Identifier key, RuntimeLevelConfig config) Gets or creates a new persistent level with the given identifier andRuntimeLevelConfig.openTemporaryLevel(RuntimeLevelConfig config) Creates a new temporary level with the givenRuntimeLevelConfigthat will not be saved and will be deleted when the server exits.openTemporaryLevel(net.minecraft.resources.Identifier key, RuntimeLevelConfig config) Creates a new temporary level with the given identifier andRuntimeLevelConfigthat will not be saved and will be deleted when the server exits.booleantickDeleteLevel(net.minecraft.server.level.ServerLevel level) booleantickUnloadLevel(net.minecraft.server.level.ServerLevel level)
-
Field Details
-
LOGGER
public static final org.apache.logging.log4j.Logger LOGGER -
DEFAULT_DIM_TYPE
public static final net.minecraft.resources.ResourceKey<net.minecraft.world.level.dimension.DimensionType> DEFAULT_DIM_TYPE
-
-
Method Details
-
get
Gets theEngineLevelsinstance for the given server instance.- Parameters:
server- the server to work with- Returns:
- the
EngineLevelsinstance to work with runtime dimensions
-
openTemporaryLevel
Creates a new temporary level with the givenRuntimeLevelConfigthat will not be saved and will be deleted when the server exits.The created level is returned asynchronously through a
RuntimeLevelHandle. This handle can be used to acquire theServerLevelobject throughRuntimeLevelHandle.asLevel(), as well as to delete the level throughRuntimeLevelHandle.delete().- Parameters:
config- the config with which to construct this temporary level- Returns:
- a future providing the created level
-
openTemporaryLevel
public RuntimeLevelHandle openTemporaryLevel(net.minecraft.resources.Identifier key, RuntimeLevelConfig config) Creates a new temporary level with the given identifier andRuntimeLevelConfigthat will not be saved and will be deleted when the server exits.The created level is returned asynchronously through a
RuntimeLevelHandle. This handle can be used to acquire theServerLevelobject throughRuntimeLevelHandle.asLevel(), as well as to delete the level throughRuntimeLevelHandle.delete().- Parameters:
key- the unique identifier for this dimensionconfig- the config with which to construct this temporary level- Returns:
- a future providing the created level
-
getOrOpenPersistentLevel
public RuntimeLevelHandle getOrOpenPersistentLevel(net.minecraft.resources.Identifier key, RuntimeLevelConfig config) Gets or creates a new persistent level with the given identifier andRuntimeLevelConfig. These levels will be saved to disk and can be restored after a server restart.If a level with this identifier exists already, it will be returned and no new level will be constructed.
Note! These persistent levels will not be automatically restored! This function must be called after a server restart with the relevant identifier and configuration such that it can be loaded.
The created level is returned asynchronously through a
RuntimeLevelHandle. This handle can be used to acquire theServerLevelobject throughRuntimeLevelHandle.asLevel(), as well as to delete the level throughRuntimeLevelHandle.delete().- Parameters:
key- the unique identifier for this dimensionconfig- the config with which to construct this persistent level- Returns:
- a future providing the created level
-
enqueueLevelDeletion
public void enqueueLevelDeletion(net.minecraft.server.level.ServerLevel level) -
enqueueLevelUnloading
public void enqueueLevelUnloading(net.minecraft.server.level.ServerLevel level) -
tickDeleteLevel
public boolean tickDeleteLevel(net.minecraft.server.level.ServerLevel level) -
tickUnloadLevel
public boolean tickUnloadLevel(net.minecraft.server.level.ServerLevel level)
-