SpitefulFox / Avaritia

The Minecraft mod to end all mods
81 stars 100 forks source link

[1.7.10][Feature request] Add NBT support for Extreme Crafting table. #99

Closed OneEyeMaker closed 7 years ago

OneEyeMaker commented 8 years ago

Hello. The title says it all. Now Extreme Crafting table (Dire Crafting table) doesn't supports recipes with NBT at all, because all recipe handlers (ExtremeShapedRecipe, ExtremeShapedOreRecipe, ...) just check equality of items and its' damages (and ignore NBT) instead of checking equality of ItemStacks. I guess, you should use ItemStack.areItemStacksEqual() instead of this and this. Please, change this mechanic to enable more complex MT recipes for Extreme Crafting table.

Morpheus1101 commented 7 years ago

Is this still an issue in the 1.1x versions?

OneEyeMaker commented 7 years ago

I found this issue in 1.11 (1.7.10). And there's no code, which checks NBT: https://github.com/SpitefulFox/Avaritia/blob/1.7.10/src/main/java/fox/spiteful/avaritia/crafting/ExtremeShapedOreRecipe.java#L201 https://github.com/SpitefulFox/Avaritia/blob/master/src/main/java/fox/spiteful/avaritia/crafting/ExtremeShapedOreRecipe.java#L202

(Shapeless recipe handler also hasn't this code).

Morpheus1101 commented 7 years ago

Have you used the 1.10 & 1.11 versions to see if this is still a thing? Im reasonably sure that the tables support NBT...

https://github.com/Morpheus1101/Avaritia/blob/1.11.2/src/main/java/fox/spiteful/avaritia/crafting/ExtremeShapedOreRecipe.java#L201

OneEyeMaker commented 7 years ago

I also don't see code for handling NBT there. The essence of this issue is that, if I add recipe with tweaker item, that requires NBT (.withTag({...}); onlyWithTag doesn't work with Extreme Crafting table), now I can craft this recipe with item without this NBT.

You should change this like so:

if (target instanceof ItemStack)
{
    ItemStack targetStack = (ItemStack) target;
    if (!OreDictionary.itemMatches(targetStack, 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;
        }
    }
}

And the same thing here

Morpheus1101 commented 7 years ago

Brandon is fixing this and it shall be in the updated vers for 1.1x soon'ish