diff --git a/src/main/java/io/singularitynet/MissionHandlers/FlatWorldGeneratorImplementation.java b/src/main/java/io/singularitynet/MissionHandlers/FlatWorldGeneratorImplementation.java index d8ccd02..72447a0 100644 --- a/src/main/java/io/singularitynet/MissionHandlers/FlatWorldGeneratorImplementation.java +++ b/src/main/java/io/singularitynet/MissionHandlers/FlatWorldGeneratorImplementation.java @@ -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); diff --git a/src/main/java/io/singularitynet/MissionHandlers/WorldUtil.java b/src/main/java/io/singularitynet/MissionHandlers/WorldUtil.java index c2b20d6..5388d84 100644 --- a/src/main/java/io/singularitynet/MissionHandlers/WorldUtil.java +++ b/src/main/java/io/singularitynet/MissionHandlers/WorldUtil.java @@ -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();