Skip to content

Commit

Permalink
Resolve #23 and #24 (is there no way to add default values to the lis…
Browse files Browse the repository at this point in the history
…t without overwriting default ones?)
  • Loading branch information
DaFuqs committed Nov 7, 2021
1 parent 553cdbb commit 34c3c4f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ yarn_mappings=1.17.1+build.14
loader_version=0.11.6

# Mod Properties
mod_version=2.1.2
mod_version=2.2.0
maven_group=de.dafuqs.lootcrates
archives_base_name=lootcrates

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import me.shedaniel.autoconfig.annotation.ConfigEntry;
import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.Comment;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

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

}
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ public static void tick(MinecraftServer server) {

// Some protection against concurrent modifications
List<LootCrateReplacementPosition> list = new ArrayList<>(replacements);
List<LootCrateReplacementPosition> tryAgainList = new ArrayList<>();
replacements.clear();

for (LootCrateReplacementPosition replacementPosition : list) {
Expand All @@ -289,6 +290,7 @@ public static void tick(MinecraftServer server) {
blockEntity = serverWorld.getBlockEntity(replacementPosition.blockPos);
} catch (Exception e) {
LootCrates.LOGGER.error("[LootCrates] Error while replacing a container with loot table '" + replacementPosition.lootTable + "' in the world '" + replacementPosition.worldKey + "' at '" + replacementPosition.blockPos + "' ) + " + e.getLocalizedMessage());
tryAgainList.add(replacementPosition);
continue;
}
if(blockEntity != null && !(blockEntity instanceof LootCrateBlockEntity)) {
Expand Down Expand Up @@ -340,12 +342,15 @@ public static void tick(MinecraftServer server) {
}
}
} else {
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.");
tryAgainList.add(replacementPosition);
}
} catch (Exception e) {
LootCrates.LOGGER.error("[LootCrates] Error while replacing a container with loot table '" + replacementPosition.lootTable + "' in the world '" + replacementPosition.worldKey + "' at '" + replacementPosition.blockPos + "' ) + " + e.getLocalizedMessage());
LootCrates.LOGGER.error("[LootCrates] Error while replacing a container with loot table '" + replacementPosition.lootTable + "' in the world '" + replacementPosition.worldKey + "' at '" + replacementPosition.blockPos + "') + " + e.getLocalizedMessage());
tryAgainList.add(replacementPosition);
}
}

replacements = tryAgainList;
}
}

Expand Down

0 comments on commit 34c3c4f

Please sign in to comment.