aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/shcm/shsupercm/fabric/citresewn
diff options
context:
space:
mode:
authorSHsuperCM <shsupercm@gmail.com>2022-01-22 19:29:01 +0200
committerSHsuperCM <shsupercm@gmail.com>2022-01-22 19:29:01 +0200
commit315e1eee9be4981ac13b49b885e153c488b18851 (patch)
tree6a4de8a445671b2f46ff748fe992f3c97faf16b7 /src/main/java/shcm/shsupercm/fabric/citresewn
parentb16f0e068ba375d0b21456811a0ae5f68a77eba0 (diff)
downloadCITResewn-315e1eee9be4981ac13b49b885e153c488b18851.tar.gz
CITResewn-315e1eee9be4981ac13b49b885e153c488b18851.tar.bz2
CITResewn-315e1eee9be4981ac13b49b885e153c488b18851.zip
Added pack name context in various places
Diffstat (limited to 'src/main/java/shcm/shsupercm/fabric/citresewn')
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/format/PropertiesGroupAdapter.java6
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/format/PropertyGroup.java12
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/pack/ActiveCITs.java3
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/pack/GlobalProperties.java6
4 files changed, 14 insertions, 13 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/format/PropertiesGroupAdapter.java b/src/main/java/shcm/shsupercm/fabric/citresewn/format/PropertiesGroupAdapter.java
index 51ff9d8..7501057 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/format/PropertiesGroupAdapter.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/format/PropertiesGroupAdapter.java
@@ -10,8 +10,8 @@ import java.util.Properties;
public class PropertiesGroupAdapter extends PropertyGroup {
public static final String EXTENSION = ".properties";
- protected PropertiesGroupAdapter(Identifier identifier) {
- super(identifier);
+ protected PropertiesGroupAdapter(String packName, Identifier identifier) {
+ super(packName, identifier);
}
@Override
@@ -20,7 +20,7 @@ public class PropertiesGroupAdapter extends PropertyGroup {
}
@Override
- public PropertyGroup load(Identifier identifier, InputStream is) throws IOException, InvalidIdentifierException {
+ public PropertyGroup load(String packName, Identifier identifier, InputStream is) throws IOException, InvalidIdentifierException {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) {
String line;
int linePos = 0, multilineSkip = 0;
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/format/PropertyGroup.java b/src/main/java/shcm/shsupercm/fabric/citresewn/format/PropertyGroup.java
index 969800e..d2ff2a4 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/format/PropertyGroup.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/format/PropertyGroup.java
@@ -10,14 +10,16 @@ import java.util.*;
public abstract class PropertyGroup {
public final Map<PropertyKey, Set<PropertyValue>> properties = new LinkedHashMap<>();
public final Identifier identifier;
+ public final String packName;
- protected PropertyGroup(Identifier identifier) {
+ protected PropertyGroup(String packName, Identifier identifier) {
+ this.packName = packName;
this.identifier = identifier;
}
public abstract String getExtension();
- public abstract PropertyGroup load(Identifier identifier, InputStream is) throws IOException, InvalidIdentifierException;
+ public abstract PropertyGroup load(String packName, Identifier identifier, InputStream is) throws IOException, InvalidIdentifierException;
protected void put(int position, String key, String keyMetadata, String delimiter, String value) throws InvalidIdentifierException {
Objects.requireNonNull(key);
@@ -38,11 +40,11 @@ public abstract class PropertyGroup {
return values;
}
- public static PropertyGroup tryParseGroup(Identifier identifier, InputStream is) throws IOException {
+ public static PropertyGroup tryParseGroup(String packName, Identifier identifier, InputStream is) throws IOException {
PropertyGroup group = null;
if (identifier.getPath().endsWith(PropertiesGroupAdapter.EXTENSION))
- group = new PropertiesGroupAdapter(identifier);
+ group = new PropertiesGroupAdapter(packName, identifier);
- return group == null ? null : group.load(identifier, is);
+ return group == null ? null : group.load(packName, identifier, is);
}
}
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/ActiveCITs.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/ActiveCITs.java
index 4d48fdc..8e5faa3 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/ActiveCITs.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/ActiveCITs.java
@@ -24,11 +24,10 @@ public class ActiveCITs implements Disposable { private ActiveCITs() {}
active.dispose();
active = null;
}
- profiler.pop();
ActiveCITs active = new ActiveCITs();
- profiler.push("citresewn:load_global_properties");
+ profiler.swap("citresewn:load_global_properties");
PackParser.loadGlobalProperties(resourceManager, active.globalProperties);
active.globalProperties.callHandlers();
profiler.pop();
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/GlobalProperties.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/GlobalProperties.java
index 7775b66..76f5d26 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/GlobalProperties.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/GlobalProperties.java
@@ -17,7 +17,7 @@ import java.util.Set;
public class GlobalProperties extends PropertyGroup {
public GlobalProperties() {
- super(new Identifier("citresewn", "global_properties"));
+ super("global_properties", new Identifier("citresewn", "global_properties"));
}
@Override
@@ -26,8 +26,8 @@ public class GlobalProperties extends PropertyGroup {
}
@Override
- public PropertyGroup load(Identifier identifier, InputStream is) throws IOException, InvalidIdentifierException {
- PropertyGroup group = PropertyGroup.tryParseGroup(identifier, is);
+ public PropertyGroup load(String packName, Identifier identifier, InputStream is) throws IOException, InvalidIdentifierException {
+ PropertyGroup group = PropertyGroup.tryParseGroup(packName, identifier, is);
if (group != null)
for (Map.Entry<PropertyKey, Set<PropertyValue>> entry : group.properties.entrySet())
this.properties.computeIfAbsent(entry.getKey(), key -> new LinkedHashSet<>()).addAll(entry.getValue());