Skip to content

Commit

Permalink
4.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
baileyholl committed Oct 4, 2023
1 parent faca4db commit 08b7e96
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ apply plugin: 'org.parchmentmc.librarian.forgegradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

version = '4.4.0'
version = '4.5.0'
//configurations {
// library
// shade // <- Create a 'shade' configuration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.hollingsworth.arsnouveau.common.util;

import com.hollingsworth.arsnouveau.common.lib.GlyphLib;
import com.hollingsworth.arsnouveau.setup.config.ConfigUtil;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.common.ForgeConfigSpec;

Expand All @@ -12,6 +13,8 @@
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import static com.hollingsworth.arsnouveau.setup.config.ConfigUtil.writeConfig;

/**
* Utility class for code around handling spell part configuration.
*/
Expand Down Expand Up @@ -129,7 +132,7 @@ private static List<String> writeComboConfig(Set<ResourceLocation> augmentLimits
public static AugmentCosts buildAugmentCosts(ForgeConfigSpec.Builder builder, Map<ResourceLocation, Integer> defaults) {
ForgeConfigSpec.ConfigValue<List<? extends String>> configValue = builder
.comment("How much an augment should cost when used on this effect or form. This overrides the default cost in the augment config.", "Example entry: \"" + GlyphLib.AugmentAmplifyID + "=50\"")
.defineList("augment_cost_overrides", writeConfig(defaults), SpellPartConfigUtil::validateAugmentLimits);
.defineList("augment_cost_overrides", ConfigUtil.writeResConfig(defaults), SpellPartConfigUtil::validateAugmentLimits);

return new AugmentCosts(configValue);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.hollingsworth.arsnouveau.setup.config;

import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.common.ForgeConfigSpec;

import java.util.List;
Expand Down Expand Up @@ -35,6 +36,13 @@ public static List<String> writeConfig(Map<String, Integer> map) {
.collect(Collectors.toList());
}

/** Produces a list of tag=limit strings suitable for saving to the configuration. */
public static List<String> writeResConfig(Map<ResourceLocation, Integer> map) {
return map.entrySet().stream()
.map(e -> e.getKey().toString() + "=" + e.getValue().toString())
.collect(Collectors.toList());
}

/** Ensure glyph_limits matches the expected regex pattern. */
public static boolean validateMap(Object rawConfig) {
if (rawConfig instanceof CharSequence raw) {
Expand Down

0 comments on commit 08b7e96

Please sign in to comment.