Recipes Check NBT

Fixes https://github.com/SpitefulFox/Avaritia/issues/99

https: //github.com/SpitefulFox/Avaritia/commit/6c6503bc23de22d76694763e1b21e38d217f56c3
Co-Authored-By: SpitefulFox <[email protected]>
This commit is contained in:
glowredmanandSpitefulFox committed 2022-02-05 00:27:48 +01:00
1 parent d6138b3ce9
commit 95c7b2bd39
3 files changed
+27 -3

No files matched your search

@@ -6,6 +6,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
@@ -224,10 +225,25 @@ public class ExtremeShapedOreRecipe implements IRecipe {
if (target instanceof ItemStack)
{
ItemStack targetStack = (ItemStack) target;
if (!OreDictionary.itemMatches((ItemStack)target, slot, false))
{
return false;
}
if (targetStack.hasTagCompound())
{
NBTTagCompound tagCompound = targetStack.getTagCompound();
if (!slot.hasTagCompound())
{
return false;
}
NBTTagCompound slotTagCompound = slot.getTagCompound();
// I forget, how to compare NBT...
if (!slotTagCompound.equals(tagCompound))
{
return false;
}
}
}
else if (target instanceof ArrayList)
{
@@ -97,6 +97,11 @@ public class ExtremeShapedRecipe implements IRecipe
{
return false;
}
if (itemstack.hasTagCompound() && !ItemStack.areItemStackTagsEqual(itemstack, itemstack1))
{
return false;
}
}
}
}
@@ -51,9 +51,12 @@ public class ExtremeShapelessRecipe implements IRecipe
if (itemstack.getItem() == itemstack1.getItem() && (itemstack1.getItemDamage() == 32767 || itemstack.getItemDamage() == itemstack1.getItemDamage()))
{
flag = true;
arraylist.remove(itemstack1);
break;
if (!itemstack1.hasTagCompound() || ItemStack.areItemStackTagsEqual(itemstack1, itemstack))
{
flag = true;
arraylist.remove(itemstack1);
break;
}
}
}