Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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??

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"
}

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.