Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import net.minecraft.util.Mth;
import net.minecraft.world.level.Level;

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

import static at.petrak.hexcasting.api.mod.HexConfig.anyMatchResLoc;
Expand Down Expand Up @@ -199,7 +200,12 @@ public static final class Server implements HexConfig.ServerConfigAccess, Config

// TODO: hook this up to the config, change Jankery, test, also test scroll injects on fabric
@ConfigEntry.Gui.Tooltip
private List<ResourceLocation> loreInjections = HexLootHandler.DEFAULT_LORE_INJECTS;
private List<String> loreInjectionsRaw = HexLootHandler.DEFAULT_LORE_INJECTS
.stream()
.map(ResourceLocation::toString)
.toList();
@ConfigEntry.Gui.Excluded
private transient List<ResourceLocation> loreInjections;
@ConfigEntry.Gui.Tooltip
private double loreChance = HexLootHandler.DEFAULT_LORE_CHANCE;

Expand All @@ -222,6 +228,16 @@ public void validatePostLoad() throws ValidationException {
throw new ValidationException("Bad parsing of scroll injects", e);
}

this.loreInjections = new ArrayList<>();
try {
for (var table : this.loreInjectionsRaw) {
ResourceLocation loc = new ResourceLocation(table);
this.loreInjections.add(loc);
}
} catch (Exception e) {
throw new ValidationException("Bad parsing of lore injects", e);
}

this.loreChance = Mth.clamp(this.loreChance, 0.0, 1.0);
}

Expand Down