ImmersiveMC

ImmersiveMC

2M Downloads

``Item#onCraftedBy`` not called upon crafting an item

nonamecrackers2 opened this issue ยท 4 comments

commented

When crafting using ImmersiveMC, the method Item#onCraftedBy is not called. While only used by maps in the vanilla game, it breaks functionality implemented by other mods that override onCraftedBy. If you want to replicate the bug, install "Cracker's Wither Storm Mod" (any version), along with ImmersiveMC of course, and try to craft the Formidibomb using a crafting table using the immersive crafting system. The Formidibomb, when hovered over in the inventory menu, should have a timer applied to it, but it does not. This is because onCraftedBy is not called. Crafting the Formidibomb using the vanilla crafting table GUI does not have this problem.

I believe to fix this issue, all you would need to do is call ItemStack#onCraftedBy in the Swap class when an item is crafted by any crafting station. This would also fix items not being counted towards being crafted in the statistics menu.

commented

Thank you for catching this! Fixing this would likely also fix #219, so much appreciated :)

EDIT: Not sure why I thought this would fix #219; it doesn't get the crafting inventory. Still really good to fix, though, so thank you again

commented

You're welcome, glad I could help!

commented

Looking at this a bit more closely, I may want to do a more ideal call using ResultSlot so we get both the onCraftedBy() call and (Neo)Forge's event hooks called.

Would probably be super hack-y though, needs further investigation.

EDIT: Going to skip the event for now. If it's needed by some mod, I'll add it likely by just firing the event directly.

commented

Thank you again for catching this! I'm hoping to have the next version of ImmersiveMC (1.5.0 Beta 2) out in the next few weeks, so this fix should be in that version!