diff options
author | SHsuperCM <shsupercm@gmail.com> | 2022-02-14 15:36:15 +0200 |
---|---|---|
committer | SHsuperCM <shsupercm@gmail.com> | 2022-02-14 15:36:15 +0200 |
commit | 32caf009812501e9e9a8f9d835726f12723c4a17 (patch) | |
tree | ff657482865d1b319bad4a2c50465c19df4df96d | |
parent | cf735c9f3205208801a9675e6b6217dc84b1ea3c (diff) | |
download | CITResewn-32caf009812501e9e9a8f9d835726f12723c4a17.tar.gz CITResewn-32caf009812501e9e9a8f9d835726f12723c4a17.tar.bz2 CITResewn-32caf009812501e9e9a8f9d835726f12723c4a17.zip |
Fixed some minor bugs
-rw-r--r-- | src/main/java/shcm/shsupercm/fabric/citresewn/pack/PackParser.java | 17 | ||||
-rw-r--r-- | src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertiesGroupAdapter.java | 2 |
2 files changed, 11 insertions, 8 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/PackParser.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/PackParser.java index 7555866..1dbc22d 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/PackParser.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/PackParser.java @@ -16,6 +16,7 @@ import shcm.shsupercm.fabric.citresewn.pack.format.PropertyGroup; import shcm.shsupercm.fabric.citresewn.pack.format.PropertyKey; import shcm.shsupercm.fabric.citresewn.pack.format.PropertyValue; +import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -48,7 +49,7 @@ public class PackParser { Identifier identifier = new Identifier("minecraft", root + "/cit.properties"); try { globalProperties.load(pack.getName(), identifier, pack.open(ResourceType.CLIENT_RESOURCES, identifier)); - } catch (ResourceNotFoundException ignored) { + } catch (FileNotFoundException ignored) { } catch (IOException e) { CITResewn.logErrorLoading("Errored while loading global properties: " + identifier + " from " + pack.getName()); e.printStackTrace(); @@ -65,6 +66,8 @@ public class PackParser { String packName = null; try (Resource resource = resourceManager.getResource(identifier)) { cits.add(parseCIT(PropertyGroup.tryParseGroup(packName = resource.getResourcePackName(), identifier, resource.getInputStream()))); + } catch (CITParsingException e) { + CITResewn.logErrorLoading(e.getMessage()); } catch (Exception e) { CITResewn.logErrorLoading("Errored while loading cit: " + identifier + (packName == null ? "" : " from " + packName)); e.printStackTrace(); @@ -74,7 +77,6 @@ public class PackParser { return cits; } - public static CIT<?> parseCIT(PropertyGroup properties) throws CITParsingException { CITType citType = CITRegistry.parseType(properties); @@ -89,11 +91,12 @@ public class PackParser { } for (CITCondition condition : new ArrayList<>(conditions)) - for (Class<? extends CITCondition> siblingConditionType : condition.siblingConditions()) - conditions.replaceAll( - siblingCondition -> siblingConditionType == siblingCondition.getClass() ? - condition.modifySibling(siblingConditionType, siblingCondition) : - siblingCondition); + if (condition != null) + for (Class<? extends CITCondition> siblingConditionType : condition.siblingConditions()) + conditions.replaceAll( + siblingCondition -> siblingConditionType == siblingCondition.getClass() ? + condition.modifySibling(siblingConditionType, siblingCondition) : + siblingCondition); WeightCondition weight = new WeightCondition(); diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertiesGroupAdapter.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertiesGroupAdapter.java index fb694ae..8ad2ccf 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertiesGroupAdapter.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertiesGroupAdapter.java @@ -93,7 +93,7 @@ public class PropertiesGroupAdapter extends PropertyGroup { builder.append(c); } - if (key == null) + if (key == null) //todo handle : separator throw new IOException("Missing separator in line " + linePos); int pos = linePos - multilineSkip; |