Skip to content

Commit 4f8a553

Browse files
committed
backport fix to 1.15.2
1 parent e61f1bc commit 4f8a553

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ yarn_build=3
88
loader_version=0.8.2+build.194
99

1010
# Mod Properties
11-
mod_version = 2.4.0
11+
mod_version = 2.4.1
1212
maven_group = io.github.cottonmc
1313
archives_base_name = libcd
1414

src/main/java/io/github/cottonmc/libcd/api/tweaker/recipe/RecipeParser.java

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,28 +107,28 @@ else if (input instanceof String) {
107107
}
108108

109109
public static ItemStack processItemStack(Object input) throws CDSyntaxError {
110-
if (input instanceof ItemStack) return (ItemStack)input;
110+
if (input instanceof ItemStack) return (ItemStack) input;
111111
else if (input instanceof String) {
112-
String in = (String)input;
112+
String in = (String) input;
113113
int atIndex = in.lastIndexOf('@');
114114
int nbtIndex = in.indexOf('{');
115115
int count = 1;
116116
if (atIndex != -1 && atIndex > in.lastIndexOf('}')) {
117117
count = Integer.parseInt(in.substring(atIndex + 1));
118118
in = in.substring(0, atIndex);
119119
}
120-
Item item;
121120
String nbt = "";
121+
if (nbtIndex != -1) {
122+
nbt = in.substring(nbtIndex);
123+
in = in.substring(0, nbtIndex);
124+
}
125+
Item item;
122126
if (in.indexOf('#') == 0) {
123-
if (nbtIndex != -1) {
124-
nbt = in.substring(nbtIndex);
125-
in = in.substring(0, nbtIndex);
126-
}
127127
String tag = in.substring(1);
128128
Tag<Item> itemTag = ItemTags.getContainer().get(new Identifier(tag));
129129
if (itemTag == null) throw new CDSyntaxError("Failed to get item tag for output: " + in);
130130
item = TagHelper.ITEM.getDefaultEntry(itemTag);
131-
} else if (in.contains("->") && in.indexOf("->") < in.indexOf('{')) {
131+
} else if (in.contains("->")) {
132132
ItemStack stack = TweakerUtils.INSTANCE.getSpecialStack(in);
133133
if (stack.isEmpty())
134134
throw new CDSyntaxError("Failed to get special stack for output: " + in);
@@ -137,10 +137,6 @@ else if (input instanceof String) {
137137
}
138138
return stack;
139139
} else {
140-
if (nbtIndex != -1) {
141-
nbt = in.substring(nbtIndex);
142-
in = in.substring(0, nbtIndex);
143-
}
144140
item = TweakerUtils.INSTANCE.getItem(in);
145141
}
146142

0 commit comments

Comments
 (0)