diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java index 4680f8c1a..a49ab760f 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java @@ -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; @@ -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 loreInjections = HexLootHandler.DEFAULT_LORE_INJECTS; + private List loreInjectionsRaw = HexLootHandler.DEFAULT_LORE_INJECTS + .stream() + .map(ResourceLocation::toString) + .toList(); + @ConfigEntry.Gui.Excluded + private transient List loreInjections; @ConfigEntry.Gui.Tooltip private double loreChance = HexLootHandler.DEFAULT_LORE_CHANCE; @@ -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); }