Jump to content

(1.20) Beginner having issue with making a crafting recipe


Evanski

Recommended Posts

Hello, Im beginning to learn how to mod with forge, I previously was messing around with spigot but wanted to switch from plugins to full fledged modding.

I'm trying to make a recipe for turning a block into charcoal
 

  ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.CHARCOAL_BLOCK_ITEM.get())
    .pattern("CCC")
    .pattern("CCC")
    .pattern("CCC")
    .define('C', Items.CHARCOAL)
    .unlockedBy(getHasName(Items.CHARCOAL), has(Items.CHARCOAL))
    .save(pRecipeOutput);

This is under an Override build Recipes class and registered with data gen

However I get this error that I don't understand the reason behind why I'm getting it
 

Quote

java.lang.ClassCastException: class net.minecraft.world.item.crafting.ShapelessRecipe cannot be cast to class net.minecraft.world.item.crafting.AbstractCookingRecipe (net.minecraft.world.item.crafting.ShapelessRecipe and net.minecraft.world.item.crafting.AbstractCookingRecipe are in module [email protected] of loader 'TRANSFORMER' @7c5d1d25)

This removes the normal recipe of smelting any wood log into charcoal, but my custom recipe is there and works

Any help with the proper way of doing this and solving this issue is appreciated :)

ps:
Is the only way to make recipes with forge is through Minecraft's datapack system??
Am I to belive that Spigot has a better implementation of custom recipes then Forge, a Mod API??

Link to comment
Share on other sites

Pretty sure you get that error because ShapelessRecipe is only for recipes that are crafted using a grid, and don't need to be arranged in a certain way. You have to use AbstractCookingRecipe for any recipe that uses the [smeltable item - fuel item - result item] combination.

But I don't think you really need to be messing with code here for recipes. You should just be able to copy what the minecraft\recipes\iron_ingot_from_smelting_raw_iron.json does and replace the ingredient item and your result item:
 

{
  "type": "minecraft:smelting",
  "category": "misc",
  "cookingtime": 200,
  "experience": 0.7,
  "group": "iron_ingot",
  "ingredient": {
    "item": "minecraft:raw_iron"
  },
  "result": "minecraft:iron_ingot"
}

or just add the block to the logs_that_burn_tag since the Minecraft recipe for charcoal uses that:

{
  "type": "minecraft:smelting",
  "category": "misc",
  "cookingtime": 200,
  "experience": 0.15,
  "ingredient": {
    "tag": "minecraft:logs_that_burn"
  },
  "result": "minecraft:charcoal"
}
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.