neoforged / NeoForge

Neo Modding API for Minecraft, based on Forge
https://neoforged.net
Other
1.24k stars 179 forks source link

Bring back patch to allow itemstack output for cooking recipes #290

Closed TelepathicGrunt closed 12 months ago

TelepathicGrunt commented 1 year ago

I made heavy use of this recipe json change to allow smelting to output more than 1 of an item in my mod. image

I do not know how to bring back this change in my mod easily. I'm not very good at targeting codecs in a compatible way that doesn't cause log messages with other mods doing the same codec mixins where users keep thinking log entries means mod is broken...

The old patch looked like this. https://github.com/MinecraftForge/MinecraftForge/blob/a5ff932125dbf132ff9f1c8c39089cdb9bdbecea/patches/minecraft/net/minecraft/data/recipes/SimpleCookingRecipeBuilder.java.patch

In 1.20.2+, SimpleCookingSerializer now uses a codec ((MapCodec)BuiltInRegistries.ITEM.byNameCodec().xmap(ItemStack::new, ItemStack::getItem).fieldOf("result")).forGetter(abstractCookingRecipe -> abstractCookingRecipe.result)

Note, some consideration is needed for AbstractFurnaceBlockEntity's canBurn to make sure recipe output nbt matches existing output item in slot. Maybe either not smelt if output slot would go beyond 64 if recipe has higher output count

TelepathicGrunt commented 1 year ago

Closing as someone helped show that furnaces can take custom recipes as long as you specify smelting as the recipe type. Here's implementation if anyone needs it https://github.com/TelepathicGrunt/Bumblezone/commit/31af6409fb7be673e174ff0edd05c7da42e44d3c

Technici4n commented 1 year ago

I think this is clearly a regression that we should fix.