Extended Crafting

Extended Crafting

34M Downloads

[Forge 1.19.2] Extended Crafting’s tables do not set the crafting player for forge’s hooks

TelepathicGrunt opened this issue · 0 comments

commented

I was using a recipe that does a check in matches to see who is crafting that recipe. To make this work, I have to use ForgeHooks.getCraftingPlayer() as this is what it was for.

What I found is Extended Crafting’s tables do not set this ForgeHook here

remaining = player.level.getRecipeManager().getRemainingItemsFor(RecipeType.CRAFTING, (CraftingContainer) this.matrix, player.level);

The ideal usage is before getting the recipe output, set the crafting player in the forge hook to who is crafting and then set it back to null afterwards.

This is how forge patched vanilla’s ResultSlot to implement this hook.
https://github.com/MinecraftForge/MinecraftForge/blob/0e66b7b21757e510aef706ca320881b9eb268822/patches/minecraft/net/minecraft/world/inventory/ResultSlot.java.patch#L15

Basically copy that into your mod’s custom recipe slot and it should help with a few niche mod compat! :)

hope this helps!