mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 08:17:35 +00:00
Fix CraftingHelper.parseShapred error. Closes #3979
This commit is contained in:
1 parent
22d243e70d
commit
5e70ee45be
1 file changed
+12
-1
@@ -331,12 +331,23 @@ public class CraftingHelper {
|
||||
}
|
||||
|
||||
ret.input = NonNullList.withSize(ret.width * ret.height, Ingredient.field_193370_a);
|
||||
|
||||
Set<Character> keys = Sets.newHashSet(itemMap.keySet());
|
||||
keys.remove(' ');
|
||||
|
||||
int x = 0;
|
||||
for (char chr : shape.toCharArray())
|
||||
{
|
||||
ret.input.add(x++, itemMap.get(chr));
|
||||
Ingredient ing = itemMap.get(chr);
|
||||
if (ing == null)
|
||||
throw new IllegalArgumentException("Pattern references symbol '" + chr + "' but it's not defined in the key");
|
||||
ret.input.set(x++, ing);
|
||||
keys.remove(chr);
|
||||
}
|
||||
|
||||
if (!keys.isEmpty())
|
||||
throw new IllegalArgumentException("Key defines symbols that aren't used in pattern: " + keys);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user