mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-16 01:55:15 +00:00
Fix other mods crashing because of alternate implementations of metadata
Closes #352 Closes #353
This commit is contained in:
1 parent
3cf1619b2e
commit
25cd574662
1 file changed
+6
-4
@@ -48,22 +48,24 @@ public final class LexiconRecipeMappings {
|
||||
}
|
||||
|
||||
public static EntryData getDataForStack(ItemStack stack) {
|
||||
ItemStack wildCopy = stack.copy();
|
||||
wildCopy.setItemDamage(OreDictionary.WILDCARD_VALUE);
|
||||
String wildKey = stackToString(wildCopy);
|
||||
String wildKey = stackToString(stack, true);
|
||||
if (mappings.containsKey(wildKey))
|
||||
return mappings.get(wildKey);
|
||||
return mappings.get(stackToString(stack));
|
||||
}
|
||||
|
||||
public static String stackToString(ItemStack stack) {
|
||||
return stackToString(stack, false);
|
||||
}
|
||||
|
||||
public static String stackToString(ItemStack stack, boolean forceIgnore) {
|
||||
if(stack == null || stack.getItem() == null)
|
||||
return "NULL";
|
||||
|
||||
if(stack.hasTagCompound() && stack.getItem() instanceof IRecipeKeyProvider)
|
||||
return ((IRecipeKeyProvider) stack.getItem()).getKey(stack);
|
||||
|
||||
return stack.getUnlocalizedName() + (ignoreMeta(stack) ? "" : "~" + stack.getItemDamage());
|
||||
return stack.getUnlocalizedName() + (forceIgnore || ignoreMeta(stack) ? "" : "~" + stack.getItemDamage());
|
||||
}
|
||||
|
||||
public static boolean ignoreMeta(ItemStack stack) {
|
||||
|
||||
Reference in new issue
Block a user