Skip to content

Commit 34c3c4f

Browse files
committed
Resolve #23 and #24 (is there no way to add default values to the list without overwriting default ones?)
1 parent 553cdbb commit 34c3c4f

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ yarn_mappings=1.17.1+build.14
77
loader_version=0.11.6
88

99
# Mod Properties
10-
mod_version=2.1.2
10+
mod_version=2.2.0
1111
maven_group=de.dafuqs.lootcrates
1212
archives_base_name=lootcrates
1313

src/main/java/de/dafuqs/lootcrates/config/LootCratesConfig.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import me.shedaniel.autoconfig.annotation.ConfigEntry;
66
import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.Comment;
77

8+
import java.util.ArrayList;
9+
import java.util.Arrays;
810
import java.util.List;
911

1012
@Config(name = "LootCrates")
@@ -55,6 +57,8 @@ public class LootCratesConfig implements ConfigData {
5557
So feel free to leave it at 1 if you want loot to be available instantly for every unique player.""")
5658
public boolean ReplaceVanillaWorldgenChests = true;
5759
@ConfigEntry.Category("worldgen")
58-
public List<String> ReplaceVanillaWorldgenChestsDimensionsBlacklist = List.of("spectrum:deeper_down");
60+
@Comment(value = """
61+
Dimension identifiers where chests will not be replaced""")
62+
public final List<String> ReplaceVanillaWorldgenChestsDimensionsBlacklist = new ArrayList<>();
5963

6064
}

src/main/java/de/dafuqs/lootcrates/worldgen/LootCratesWorldgenReplacer.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ public static void tick(MinecraftServer server) {
278278

279279
// Some protection against concurrent modifications
280280
List<LootCrateReplacementPosition> list = new ArrayList<>(replacements);
281+
List<LootCrateReplacementPosition> tryAgainList = new ArrayList<>();
281282
replacements.clear();
282283

283284
for (LootCrateReplacementPosition replacementPosition : list) {
@@ -289,6 +290,7 @@ public static void tick(MinecraftServer server) {
289290
blockEntity = serverWorld.getBlockEntity(replacementPosition.blockPos);
290291
} catch (Exception e) {
291292
LootCrates.LOGGER.error("[LootCrates] Error while replacing a container with loot table '" + replacementPosition.lootTable + "' in the world '" + replacementPosition.worldKey + "' at '" + replacementPosition.blockPos + "' ) + " + e.getLocalizedMessage());
293+
tryAgainList.add(replacementPosition);
292294
continue;
293295
}
294296
if(blockEntity != null && !(blockEntity instanceof LootCrateBlockEntity)) {
@@ -340,12 +342,15 @@ public static void tick(MinecraftServer server) {
340342
}
341343
}
342344
} else {
343-
LootCrates.LOGGER.error("[LootCrates] Error while replacing a container with loot table '" + replacementPosition.lootTable + "' in the world '" + replacementPosition.worldKey + "' at '" + replacementPosition.blockPos + "' ). The chunk at that pos is not loaded.");
345+
tryAgainList.add(replacementPosition);
344346
}
345347
} catch (Exception e) {
346-
LootCrates.LOGGER.error("[LootCrates] Error while replacing a container with loot table '" + replacementPosition.lootTable + "' in the world '" + replacementPosition.worldKey + "' at '" + replacementPosition.blockPos + "' ) + " + e.getLocalizedMessage());
348+
LootCrates.LOGGER.error("[LootCrates] Error while replacing a container with loot table '" + replacementPosition.lootTable + "' in the world '" + replacementPosition.worldKey + "' at '" + replacementPosition.blockPos + "') + " + e.getLocalizedMessage());
349+
tryAgainList.add(replacementPosition);
347350
}
348351
}
352+
353+
replacements = tryAgainList;
349354
}
350355
}
351356

0 commit comments

Comments
 (0)