Skip to content

Commit a8f726f

Browse files
committed
Sort custom dimensions last by default instead of with the overworld
1 parent 8444230 commit a8f726f

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

common/src/main/java/de/bluecolored/bluemap/common/config/BlueMapConfigManager.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,13 @@ private Map<String, MapConfig> loadMapConfigs(Collection<ServerWorld> autoConfig
237237
Files.writeString(
238238
configManager.resolveConfigFile(MAPS_CONFIG_FOLDER_NAME + "/nether"),
239239
createNetherMapTemplate("Nether", worldFolder,
240-
DataPack.DIMENSION_THE_NETHER, 0).build(),
240+
DataPack.DIMENSION_THE_NETHER, 100).build(),
241241
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING
242242
);
243243
Files.writeString(
244244
configManager.resolveConfigFile(MAPS_CONFIG_FOLDER_NAME + "/end"),
245245
createEndMapTemplate("End", worldFolder,
246-
DataPack.DIMENSION_THE_END, 0).build(),
246+
DataPack.DIMENSION_THE_END, 200).build(),
247247
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING
248248
);
249249
} else {
@@ -278,9 +278,10 @@ private Map<String, MapConfig> loadMapConfigs(Collection<ServerWorld> autoConfig
278278
if (i > 1) name = name + " (" + i + ")";
279279

280280
ConfigTemplate template = switch (world.getDimension().getFormatted()) {
281-
case "minecraft:the_nether" -> createNetherMapTemplate(name, worldFolder, dimension, i - 1);
282-
case "minecraft:the_end" -> createEndMapTemplate(name, worldFolder, dimension, i - 1);
283-
default -> createOverworldMapTemplate(name, worldFolder, dimension, i - 1);
281+
case "minecraft:overworld" -> createOverworldMapTemplate(name, worldFolder, dimension, i - 1);
282+
case "minecraft:the_nether" -> createNetherMapTemplate(name, worldFolder, dimension, i - 1 + 100);
283+
case "minecraft:the_end" -> createEndMapTemplate(name, worldFolder, dimension, i - 1 + 200);
284+
default -> createOverworldMapTemplate(name, worldFolder, dimension, i - 1 + 300);
284285
};
285286

286287
Files.writeString(
@@ -376,10 +377,10 @@ private String sanitiseMapId(String id) {
376377
return id.replaceAll("\\W", "_");
377378
}
378379

379-
private ConfigTemplate createOverworldMapTemplate(String name, Path worldFolder, Key dimension, int index) throws IOException {
380+
private ConfigTemplate createOverworldMapTemplate(String name, Path worldFolder, Key dimension, int sorting) throws IOException {
380381
return configManager.loadConfigTemplate(MAP_STORAGE_CONFIG_NAME)
381382
.setVariable("name", name)
382-
.setVariable("sorting", "" + index)
383+
.setVariable("sorting", "" + sorting)
383384
.setVariable("world", formatPath(worldFolder))
384385
.setVariable("dimension", dimension.getFormatted())
385386
.setVariable("sky-color", "#7dabff")
@@ -389,10 +390,10 @@ private ConfigTemplate createOverworldMapTemplate(String name, Path worldFolder,
389390
.setConditional("remove-nether-ceiling", false);
390391
}
391392

392-
private ConfigTemplate createNetherMapTemplate(String name, Path worldFolder, Key dimension, int index) throws IOException {
393+
private ConfigTemplate createNetherMapTemplate(String name, Path worldFolder, Key dimension, int sorting) throws IOException {
393394
return configManager.loadConfigTemplate(MAP_STORAGE_CONFIG_NAME)
394395
.setVariable("name", name)
395-
.setVariable("sorting", "" + (100 + index))
396+
.setVariable("sorting", "" + sorting)
396397
.setVariable("world", formatPath(worldFolder))
397398
.setVariable("dimension", dimension.getFormatted())
398399
.setVariable("sky-color", "#290000")
@@ -402,10 +403,10 @@ private ConfigTemplate createNetherMapTemplate(String name, Path worldFolder, Ke
402403
.setConditional("remove-nether-ceiling", true);
403404
}
404405

405-
private ConfigTemplate createEndMapTemplate(String name, Path worldFolder, Key dimension, int index) throws IOException {
406+
private ConfigTemplate createEndMapTemplate(String name, Path worldFolder, Key dimension, int sorting) throws IOException {
406407
return configManager.loadConfigTemplate(MAP_STORAGE_CONFIG_NAME)
407408
.setVariable("name", name)
408-
.setVariable("sorting", "" + (200 + index))
409+
.setVariable("sorting", "" + sorting)
409410
.setVariable("world", formatPath(worldFolder))
410411
.setVariable("dimension", dimension.getFormatted())
411412
.setVariable("sky-color", "#080010")

0 commit comments

Comments
 (0)