Game crashes if a Honey Block is inserted in the Electric Furnace from Tech Reborn or the Powered Furnace from Energized Power
JDDev0 opened this issue ยท 6 comments
RecipeType.SMELTING
requires recipes to extend from net.minecraft.world.item.crafting.SmeltingRecipe
. The class com.telepathicgrunt.the_bumblezone.items.recipes.ItemStackSmeltingRecipe
should extend SmeltingRecipe
- You need to change the extends from AbstractCookingRecipe
to SmeltingRecipe
and remove RecipeType.SMELTING
from the super constructor call, afterwards the crash should be fixed.
Currently the recipes using the the_bumblezone:itemstack_smelting_recipe
recipe type are not shown in REI on Forge and cause crashes in Energized Power and Tech Reborn - See crash report after a Honey Block was inserted in the Electric Furnace from Tech Reborn: crash-2023-12-13_18.10.26-server.txt.
Kinda surprising as AbstractCookingRecipe implements everything they need to know for the class and the recipe type being smelting for what it is for. Checking each derived class, I don't see anything special that would require casting at all. Just casting to AbstractCookingRecipe would be enough.
In Tech Reborn and Energized Power SmeltingRecipe
is explicitly used and not AbstractCookingRecipe
:
currentRecipe
is of typeSmeltingRecipe
: See https://github.com/TechReborn/TechReborn/blob/ab3cce7f2855b0d322cf8199bb03d445a4671b10/src/main/java/techreborn/blockentity/machine/tier1/ElectricFurnaceBlockEntity.java#L33
This line will try to cast the recipe to a SmeltingRecipe
: Optional<SmeltingRecipe> testRecipe = world.getRecipeManager().getFirstMatch(RecipeType.SMELTING, inventory, world).map(RecipeEntry::value);
But my question is, why the cast? Why cant you just check for the recipe type like you're doing and keep it as AbstractCookingRecipe? What necessitates the need to cast to SmeltingRecipe when it doesn't seem to prove any extra functionality?
I will fix my recipe to extend it but I'm feeling like this is an assumption that mods made that turned out to be weird and not always safe to do.
OH. I see. Then I am definitely incorrect here as recipe type itself expects SmeltingRecipe
public static final RecipeType<SmeltingRecipe> SMELTING = RecipeType.register("smelting");