diff options
10 files changed, 46 insertions, 13 deletions
diff --git a/gradle.properties b/gradle.properties index e32e107..627f014 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ minecraft_version=1.17.1 yarn_mappings=1.17.1+build.39 loader_version=0.11.6 # Mod Properties -mod_version=0.3.0 +mod_version=0.4.0 maven_group=shcm.shsupercm.fabric archives_base_name=CITResewn diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/ActiveCITs.java b/src/main/java/shcm/shsupercm/fabric/citresewn/ActiveCITs.java index b0d97ab..3069585 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/ActiveCITs.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/ActiveCITs.java @@ -34,7 +34,7 @@ public class ActiveCITs { if (type instanceof ArmorItem armorType) citArmor.computeIfAbsent(armorType, t -> new ArrayList<>()).add(armor); else - CITResewn.LOG.error("Skipping item type: " + Registry.ITEM.getId(type) + " is not armor in " + cit.pack.resourcePack.getName() + " -> " + cit.propertiesIdentifier.getPath()); + CITResewn.logErrorLoading("Skipping item type: " + Registry.ITEM.getId(type) + " is not armor in " + cit.pack.resourcePack.getName() + " -> " + cit.propertiesIdentifier.getPath()); else if (cit instanceof CITElytra) citElytra.add((CITElytra) cit); else if (cit instanceof CITEnchantment) diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/CITResewn.java b/src/main/java/shcm/shsupercm/fabric/citresewn/CITResewn.java index cf85a2c..0eb4ec5 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/CITResewn.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/CITResewn.java @@ -3,6 +3,7 @@ package shcm.shsupercm.fabric.citresewn; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import shcm.shsupercm.fabric.citresewn.config.CITResewnConfig; @@ -22,4 +23,16 @@ public class CITResewn implements ClientModInitializer { config = CITResewnConfig.read(); } + + public static void logErrorLoading(String message) { + if (CITResewnConfig.INSTANCE().mute_errors) + return; + LOG.error(message); + } + + public static void logWarnLoading(String message) { + if (CITResewnConfig.INSTANCE().mute_warns) + return; + LOG.error(message); + } } diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfig.java b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfig.java index 38995ca..475cd14 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfig.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfig.java @@ -9,6 +9,8 @@ import java.io.*; public class CITResewnConfig { public boolean enabled = true; + public boolean mute_errors = false; + public boolean mute_warns = false; private static final File FILE = new File("config/citresewn.json"); public static CITResewnConfig INSTANCE() { diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java index bc00d2b..a47e6d4 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java @@ -20,8 +20,8 @@ public class CITResewnConfigScreenFactory { ConfigCategory category = builder.getOrCreateCategory(new LiteralText("")); ConfigEntryBuilder entryBuilder = builder.entryBuilder(); - category.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.citresewn.citsEnabled.title"), currentConfig.enabled) - .setTooltip(new TranslatableText("config.citresewn.citsEnabled.tooltip")) + category.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.citresewn.enabled.title"), currentConfig.enabled) + .setTooltip(new TranslatableText("config.citresewn.enabled.tooltip")) .setSaveConsumer(newConfig -> { if (currentConfig.enabled != newConfig) { currentConfig.enabled = newConfig; @@ -31,6 +31,18 @@ public class CITResewnConfigScreenFactory { .setDefaultValue(defaultConfig.enabled) .build()); + category.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.citresewn.mute_errors.title"), currentConfig.mute_errors) + .setTooltip(new TranslatableText("config.citresewn.mute_errors.tooltip")) + .setSaveConsumer(newConfig -> currentConfig.mute_errors = newConfig) + .setDefaultValue(defaultConfig.mute_errors) + .build()); + + category.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.citresewn.mute_warns.title"), currentConfig.mute_warns) + .setTooltip(new TranslatableText("config.citresewn.mute_warns.tooltip")) + .setSaveConsumer(newConfig -> currentConfig.mute_warns = newConfig) + .setDefaultValue(defaultConfig.mute_warns) + .build()); + return builder.build(); } } diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ModelLoaderMixin.java b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ModelLoaderMixin.java index f0fa82d..a5e6a30 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ModelLoaderMixin.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ModelLoaderMixin.java @@ -59,7 +59,7 @@ public abstract class ModelLoaderMixin { this.modelsToBake.put(id, unbakedModel); } } catch (Exception e) { - CITResewn.LOG.error(e.getMessage()); + CITResewn.logErrorLoading(e.getMessage()); } } @@ -99,7 +99,7 @@ public abstract class ModelLoaderMixin { if (override != null) citItem.subItems.put(override, this.bakedModels.get(new ResewnItemModelIdentifier(citModelEntry.getValue().id))); else { - CITResewn.LOG.error("Skipping sub cit: No such sub item model \"" + citModelEntry.getKey().getPath().substring(5) + "\" in " + citItem.pack.resourcePack.getName() + " -> " + citItem.propertiesIdentifier.getPath()); + CITResewn.logErrorLoading("Skipping sub cit: No such sub item model \"" + citModelEntry.getKey().getPath().substring(5) + "\" in " + citItem.pack.resourcePack.getName() + " -> " + citItem.propertiesIdentifier.getPath()); } } } diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/CITPack.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/CITPack.java index 0431e62..78dc0e3 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/CITPack.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/CITPack.java @@ -28,17 +28,17 @@ public class CITPack { try { cap = Integer.parseInt(properties.getProperty("cap", "8")); } catch (NumberFormatException e) { - CITResewn.LOG.error(new CITParseException(resourcePack, new Identifier("cit.properties"), "cap is not a whole number").getMessage()); + CITResewn.logErrorLoading(new CITParseException(resourcePack, new Identifier("cit.properties"), "cap is not a whole number").getMessage()); } try { fade = Float.parseFloat(properties.getProperty("fade", "0.5")); } catch (NumberFormatException e) { - CITResewn.LOG.error(new CITParseException(resourcePack, new Identifier("cit.properties"), "fade is not a number").getMessage()); + CITResewn.logErrorLoading(new CITParseException(resourcePack, new Identifier("cit.properties"), "fade is not a number").getMessage()); } switch (properties.getProperty("useGlint", "true")) { case "true" -> useGlint = true; case "false" -> useGlint = false; - default -> CITResewn.LOG.error(new CITParseException(resourcePack, new Identifier("cit.properties"), "useGlint is not a boolean").getMessage()); + default -> CITResewn.logErrorLoading(new CITParseException(resourcePack, new Identifier("cit.properties"), "useGlint is not a boolean").getMessage()); } } diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/CITParser.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/CITParser.java index cf7fe19..5204c9c 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/CITParser.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/CITParser.java @@ -60,7 +60,7 @@ public class CITParser { private CITParser() {} citPack.cits.add(parseCIT(citPack, citIdentifier, citProperties)); } catch (Exception e) { - CITResewn.LOG.error(e.getMessage()); + CITResewn.logErrorLoading(e.getMessage()); } } cits.addAll(citPack.cits); diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITItem.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITItem.java index bcd719c..a2ef7ea 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITItem.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITItem.java @@ -189,7 +189,7 @@ public class CITItem extends CIT { }; if (replacement != null) { - CITResewn.LOG.error("CIT Warning: Using deprecated sub item id \"" + subItem + "\" instead of \"" + replacement + "\" in " + pack.resourcePack.getName() + " -> " + propertiesIdentifier.getPath()); + CITResewn.logWarnLoading("CIT Warning: Using deprecated sub item id \"" + subItem + "\" instead of \"" + replacement + "\" in " + pack.resourcePack.getName() + " -> " + propertiesIdentifier.getPath()); return new Identifier("minecraft", "item/" + replacement); } diff --git a/src/main/resources/assets/citresewn/lang/en_us.json b/src/main/resources/assets/citresewn/lang/en_us.json index 84fc464..60f651c 100644 --- a/src/main/resources/assets/citresewn/lang/en_us.json +++ b/src/main/resources/assets/citresewn/lang/en_us.json @@ -1,6 +1,12 @@ { "config.citresewn.title": "CIT Resewn Configuration", - "config.citresewn.citsEnabled.title": "Enabled", - "config.citresewn.citsEnabled.tooltip": "Should CITResewn load and inject cits from resourcepacks" + "config.citresewn.enabled.title": "Enabled", + "config.citresewn.enabled.tooltip": "Should CIT Resewn load and inject cits from resourcepacks", + + "config.citresewn.mute_errors.title": "Mute loading errors", + "config.citresewn.mute_errors.tooltip": "Should CIT Resewn not log cit errors", + + "config.citresewn.mute_warns.title": "Mute loading warnings", + "config.citresewn.mute_warns.tooltip": "Should CIT Resewn not log cit warnings" }
\ No newline at end of file |