Class RuntimeLevelConfig
java.lang.Object
de.luckymcdev.foundryengine.common.world.level.runtime.RuntimeLevelConfig
A configuration describing how a runtime level should be constructed. This includes properties such as the dimension
type, chunk generator, and game rules.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.level.dimension.LevelStemcreateDimensionOptions(net.minecraft.server.MinecraftServer server) Creates new dimension options from the servernet.minecraft.world.clock.ServerClockManagergetClockManager(net.minecraft.server.MinecraftServer server, net.minecraft.world.level.gamerules.GameRules gameRules) net.minecraft.world.DifficultyGets the current configured difficulty
It may not reflect the real difficulty, also checkshouldMirrorOverworldDifficulty()Gets the current configured gamerules
It may not reflect the real gamerules, also checkshouldMirrorOverworldGameRules()long@Nullable net.minecraft.world.level.chunk.ChunkGeneratorlonggetSeed()net.minecraft.util.TriStateisFlat()setClockManagerConstructor(Function<BooleanSupplier, RuntimeClockManager> clockManagerConstructor) Sets the clock manager constructorsetClockManagerConstructor(net.minecraft.world.clock.PackedClockStates clockStates) Sets the clock manager constructor toRuntimeClockManagerwith provided clock states as the default.setDifficulty(net.minecraft.world.Difficulty difficulty) Sets the level difficultysetDimensionType(net.minecraft.core.Holder<net.minecraft.world.level.dimension.DimensionType> dimensionType) Sets the level dimension typesetDimensionType(net.minecraft.resources.ResourceKey<net.minecraft.world.level.dimension.DimensionType> dimensionType) Sets the level dimension typesetFlat(boolean state) Defines if the level is a flat level or notsetFlat(net.minecraft.util.TriState state) Defines if the level is a flat level or notsetGameRule(net.minecraft.world.level.gamerules.GameRule<T> key, T value) Modifies a gamerule
Does nothing ifmirrorOverworldGameRulesis truesetGameTime(long gameTime) Sets the level's game timesetGenerator(net.minecraft.world.level.chunk.ChunkGenerator generator) Sets the level chunk generatorsetLevelConstructor(RuntimeLevel.Constructor constructor) Sets the level constructorsetMirrorOverworldClocks(boolean mirror) Defines if the level should follow the overworld clock values or notsetMirrorOverworldDifficulty(boolean mirror) Defines if the level should follow the overworld difficulty or notsetMirrorOverworldGameRules(boolean mirror) Defines if the level should follow the overworld gamerules or notsetSeed(long seed) Sets the level seedsetShouldTickTime(boolean shouldTickTime) Defines whenever the level should tick time.booleanbooleanbooleanboolean
-
Constructor Details
-
RuntimeLevelConfig
public RuntimeLevelConfig()
-
-
Method Details
-
setClockManagerConstructor
public RuntimeLevelConfig setClockManagerConstructor(net.minecraft.world.clock.PackedClockStates clockStates) Sets the clock manager constructor toRuntimeClockManagerwith provided clock states as the default.- Parameters:
clockStates- The clock states to initialize the clock manager from- Returns:
- The same instance of
RuntimeLevelConfig
-
setClockManagerConstructor
public RuntimeLevelConfig setClockManagerConstructor(Function<BooleanSupplier, RuntimeClockManager> clockManagerConstructor) Sets the clock manager constructor- Parameters:
clockManagerConstructor- The clock manager constructor to use- Returns:
- The same instance of
RuntimeLevelConfig
-
setDimensionType
public RuntimeLevelConfig setDimensionType(net.minecraft.core.Holder<net.minecraft.world.level.dimension.DimensionType> dimensionType) Sets the level dimension type- Parameters:
dimensionType- The dimension type to use- Returns:
- The same instance of
RuntimeLevelConfig
-
setDimensionType
public RuntimeLevelConfig setDimensionType(net.minecraft.resources.ResourceKey<net.minecraft.world.level.dimension.DimensionType> dimensionType) Sets the level dimension type- Parameters:
dimensionType- The dimension type to use- Returns:
- The same instance of
RuntimeLevelConfig
-
setShouldTickTime
Defines whenever the level should tick time.
Setting this set's theGameRules.ADVANCE_TIMEgamerule for the level to avoid jitter
The gamerule does not have effect ifmirrorOverworldGameRulesis set to true- Parameters:
shouldTickTime- Whenever the level should tick the time- Returns:
- The same instance of
RuntimeLevelConfig
-
setGameRule
public <T> RuntimeLevelConfig setGameRule(net.minecraft.world.level.gamerules.GameRule<T> key, T value) Modifies a gamerule
Does nothing ifmirrorOverworldGameRulesis true- Parameters:
key- The gamerule to modifyvalue- The value of the gamerule- Returns:
- The same instance of
RuntimeLevelConfig
-
setMirrorOverworldGameRules
Defines if the level should follow the overworld gamerules or not- Parameters:
mirror- Whenever it should mirror or not- Returns:
- The same instance of
RuntimeLevelConfig
-
setMirrorOverworldDifficulty
Defines if the level should follow the overworld difficulty or not- Parameters:
mirror- Whenever it should mirror or not- Returns:
- The same instance of
RuntimeLevelConfig
-
setMirrorOverworldClocks
Defines if the level should follow the overworld clock values or not- Parameters:
mirror- Whenever it should mirror or not- Returns:
- The same instance of
RuntimeLevelConfig
-
setFlat
Defines if the level is a flat level or not- Parameters:
state- If the level should be flat, not flat or use the default value- Returns:
- The same instance of
RuntimeLevelConfig
-
setFlat
Defines if the level is a flat level or not- Parameters:
state- If the level should be flat or not- Returns:
- The same instance of
RuntimeLevelConfig
-
getSeed
public long getSeed() -
setSeed
Sets the level seed- Parameters:
seed- The level seed to use- Returns:
- The same instance of
RuntimeLevelConfig
-
createDimensionOptions
public net.minecraft.world.level.dimension.LevelStem createDimensionOptions(net.minecraft.server.MinecraftServer server) Creates new dimension options from the server- Returns:
- The new dimension options
-
getGenerator
@Nullable public @Nullable net.minecraft.world.level.chunk.ChunkGenerator getGenerator() -
setGenerator
Sets the level chunk generator- Parameters:
generator- The chunk generator to use- Returns:
- The same instance of
RuntimeLevelConfig
-
getLevelConstructor
-
setLevelConstructor
Sets the level constructor- Parameters:
constructor- The level constructor to use- Returns:
- The same instance of
RuntimeLevelConfig
-
shouldTickTime
public boolean shouldTickTime() -
getDifficulty
public net.minecraft.world.Difficulty getDifficulty()Gets the current configured difficulty
It may not reflect the real difficulty, also checkshouldMirrorOverworldDifficulty()- Returns:
- The current difficulty stored in the config
-
setDifficulty
Sets the level difficulty- Parameters:
difficulty- The difficulty to use- Returns:
- The same instance of
RuntimeLevelConfig
-
getGameRules
Gets the current configured gamerules
It may not reflect the real gamerules, also checkshouldMirrorOverworldGameRules()- Returns:
- The current gamerules stored in the config
-
shouldMirrorOverworldGameRules
public boolean shouldMirrorOverworldGameRules() -
shouldMirrorOverworldDifficulty
public boolean shouldMirrorOverworldDifficulty() -
shouldMirrorOverworldClocks
public boolean shouldMirrorOverworldClocks() -
getGameTime
public long getGameTime() -
setGameTime
Sets the level's game time- Parameters:
gameTime- The new time of the game- Returns:
- The same instance of
RuntimeLevelConfig
-
isFlat
public net.minecraft.util.TriState isFlat() -
getClockManager
public net.minecraft.world.clock.ServerClockManager getClockManager(net.minecraft.server.MinecraftServer server, net.minecraft.world.level.gamerules.GameRules gameRules)
-