MightyPirates / OpenComputers

Home of the OpenComputers mod for Minecraft.
https://oc.cil.li
Other
1.6k stars 434 forks source link

Add checkDamage Boolean for li.cil.oc.util.InventoryUtils#haveSameItemType #3706

Open zeng-github01 opened 7 months ago

zeng-github01 commented 7 months ago

maybe fix #3288

Need to test

asiekierka commented 7 months ago

While this PR may help in a specific case, I am worried other mods may be patching the villager trade code to check damage for their specific items - as such, fixing this could lead to more devastating issues in cross-mod interaction.

In my opinion, the best way would be to try and re-use the same codepath vanilla uses for executing villager trades, but as I outlined in the initial comment - this would probably not be too easy.

zeng-github01 commented 7 months ago

While this PR may help in a specific case, I am worried other mods may be patching the villager trade code to check damage for their specific items - as such, fixing this could lead to more devastating issues in cross-mod interaction.

In my opinion, the best way would be to try and re-use the same codepath vanilla uses for executing villager trades, but as I outlined in the initial comment - this would probably not be too easy.

You mean there might be other mods that modify the OC code? That would cause glitches?

zeng-github01 commented 7 months ago

@asiekierka I have a new idea, can you help me test it? I will submit a new commit about it soon

Test branch

Considering that this patch is very irregular, I chose to submit it to the test branch I found the vanilla transaction code by querying useRecipe, the above code is an attempt to manually build the relevant class