aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSHsuperCM <shsupercm@gmail.com>2021-08-30 05:41:03 +0300
committerSHsuperCM <shsupercm@gmail.com>2021-08-30 05:41:03 +0300
commita7dc9b7c96178a5646d3451902730cddf28b3a60 (patch)
treeaefdea36f74aaeed65c333e3929de159fecf51c8
parentf3200b65a7ca4cbd6160b032979056164d23eed3 (diff)
downloadCITResewn-a7dc9b7c96178a5646d3451902730cddf28b3a60.tar.gz
CITResewn-a7dc9b7c96178a5646d3451902730cddf28b3a60.tar.bz2
CITResewn-a7dc9b7c96178a5646d3451902730cddf28b3a60.zip
v0.4.1: Fixed nbt name/lore requiring json
-rw-r--r--gradle.properties2
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java19
2 files changed, 16 insertions, 5 deletions
diff --git a/gradle.properties b/gradle.properties
index 627f014..3200777 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.4.0
+mod_version=0.4.1
maven_group=shcm.shsupercm.fabric
archives_base_name=CITResewn
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java
index 19e7527..34f7155 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java
@@ -166,13 +166,24 @@ public abstract class CIT {
String matchProperty = StringEscapeUtils.unescapeJava(properties.getProperty(property));
final boolean caseSensitive = !matchProperty.startsWith("i");
if (matchProperty.startsWith(caseSensitive ? "pattern:" : "ipattern:")) {
- final String pattern = caseSensitive ? matchProperty.substring(8) : matchProperty.substring(9).toLowerCase(Locale.ENGLISH);
+ matchProperty = caseSensitive ? matchProperty.substring(8) : matchProperty.substring(9).toLowerCase(Locale.ENGLISH);
+ if ((path[path.length - 1].equals("Name") || path[path.length - 1].equals("Lore")) && !matchProperty.startsWith("{"))
+ matchProperty = "{\"text\":\"" + matchProperty + "\"}";
+ final String pattern = matchProperty;
match = s -> matchesPattern(caseSensitive ? s : s.toLowerCase(), pattern, 0, s.length(), 0, pattern.length());
} else if (matchProperty.startsWith(caseSensitive ? "regex:" : "iregex:")) {
- final Pattern pattern = Pattern.compile(caseSensitive ? matchProperty.substring(5) : matchProperty.substring(6).toLowerCase(Locale.ENGLISH));
+ matchProperty = caseSensitive ? matchProperty.substring(5) : matchProperty.substring(6).toLowerCase(Locale.ENGLISH);
+ if ((path[path.length - 1].equals("Name") || path[path.length - 1].equals("Lore")) && !matchProperty.startsWith("{"))
+ matchProperty = "\\{\"text\":\"" + matchProperty + "\"}";
+ final Pattern pattern = Pattern.compile(matchProperty);
match = s -> pattern.matcher(caseSensitive ? s : s.toLowerCase()).matches();
- } else
- match = s -> s.equals(matchProperty);
+ } else {
+ matchProperty = caseSensitive ? matchProperty.substring(5) : matchProperty.substring(6).toLowerCase(Locale.ENGLISH);
+ if ((path[path.length - 1].equals("Name") || path[path.length - 1].equals("Lore")) && !matchProperty.startsWith("{"))
+ matchProperty = "{\"text\":\"" + matchProperty + "\"}";
+ final String pattern = matchProperty;
+ match = s -> s.equals(pattern);
+ }
nbtPredicates.add(new Predicate<NbtCompound>() {
public boolean test(NbtElement nbtElement, int index) {