Skip to content

Commit

Permalink
Merge pull request #76 from EHAT32/master
Browse files Browse the repository at this point in the history
implemented flat world generation
  • Loading branch information
CICS-Oleg authored Oct 16, 2024
2 parents efee0cd + c2dd6af commit 5a28d1f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public boolean createWorld(MissionInit missionInit)
props.setProperty("level-type", "flat");
props.setProperty("level-seed", String.valueOf(seed));
props.setProperty("generator-settings", this.fwparams.getGeneratorString());
WorldUtil.createLevelFlat(false, Difficulty.NORMAL, props);
WorldUtil.createLevelFlat(false, seed, Difficulty.NORMAL, props);
return true;
} catch (RuntimeException e) {
LogManager.getLogger().error(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,22 @@ public static DimensionOptionsRegistryHolder getDefaultOverworldOptions(DynamicR
return dynamicRegistryManager.get(RegistryKeys.WORLD_PRESET).entryOf(WorldPresets.DEFAULT).value().createDimensionsRegistryHolder();
}

public static void createLevelFlat(boolean hardcore,
public static DimensionOptionsRegistryHolder getFlatOverworldOptions(DynamicRegistryManager dynamicRegistryManager) {
return dynamicRegistryManager.get(RegistryKeys.WORLD_PRESET).entryOf(WorldPresets.FLAT).value().createDimensionsRegistryHolder();
}

public static void createLevelFlat(boolean hardcore, Long seed,
Difficulty difficulty, Properties properties) {
UUID uuid = UUID.randomUUID();
String worldName = uuid.toString().substring(0, 5);
String levelName = "Vereya-test" + worldName;
GameRules gameRules = new GameRules();
MinecraftClient client = MinecraftClient.getInstance();
LevelInfo levelInfo = new LevelInfo(levelName.trim(), GameMode.DEFAULT,
hardcore, difficulty,
true, gameRules, DataConfiguration.SAFE_MODE);
GeneratorOptions generatorOptions = new GeneratorOptions(seed, true, false);
client.createIntegratedServerLoader().createAndStart(levelName, levelInfo, generatorOptions, WorldUtil::getFlatOverworldOptions, client.currentScreen);
/*
DynamicRegistryManager.Impl impl = DynamicRegistryManager.create();
Expand Down

0 comments on commit 5a28d1f

Please sign in to comment.