Closed JDDev0 closed 9 months ago
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 type SmeltingRecipe
: See https://github.com/TechReborn/TechReborn/blob/ab3cce7f2855b0d322cf8199bb03d445a4671b10/src/main/java/techreborn/blockentity/machine/tier1/ElectricFurnaceBlockEntity.java#L33This 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");
Fixed now in v7.2.9
RecipeType.SMELTING
requires recipes to extend fromnet.minecraft.world.item.crafting.SmeltingRecipe
. The classcom.telepathicgrunt.the_bumblezone.items.recipes.ItemStackSmeltingRecipe
should extendSmeltingRecipe
- You need to change the extends fromAbstractCookingRecipe
toSmeltingRecipe
and removeRecipeType.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.