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

I am trying to make a smelting recipe for amethyst shards (minecraft item), making them turn into amethyst gem (mod item) using a furnace, but so far I had no success. 

I am using minecraft 1.18.1 in case it helps.

Also, here is thecode for my custom RecipeProvider class;

package com.lv.rift.datagen;

import com.lv.rift.setup.SetupRegister;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.recipes.FinishedRecipe;
import net.minecraft.data.recipes.RecipeProvider;
import net.minecraft.data.recipes.SimpleCookingRecipeBuilder;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.Ingredient;

import java.util.function.Consumer;

public class TutRecipes extends RecipeProvider {

    public TutRecipes(DataGenerator datagen)
    {
        super(datagen);
    }

    @Override
    protected void buildCraftingRecipes(Consumer<FinishedRecipe> consumer)
    {
        // --- SMELTING
        // AMETHYST SHARD -> AMETHYST GEM
        SimpleCookingRecipeBuilder.smelting(
                Ingredient.of(Items.AMETHYST_SHARD),
                SetupRegister.AMETHYST_GEM.get(),
                10.0f,
                200)
                .unlockedBy("has_amethyst_shard", has(Items.AMETHYST_SHARD))
                .save(consumer, "amethyst_gem1");
    }
}

The item amethyst_gem is shown correctly in the game, with its name and texture. My only problem is with the smelting.

  • Author

Weird... it doesnt generate any recipe at all... Do i have to call this class somewhere else in the project?

Also, all my other classes names are highlighted but this one isnt...

  • Author

Okey so I guess i have to call it inside the DataGeneration class:

package com.lv.rift.datagen;

import com.lv.rift.Rift;
import net.minecraft.data.DataGenerator;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent;

// Registered to the bus
@Mod.EventBusSubscriber(modid = Rift.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class DataGeneration
{

    // Receives event when application is 'run'
    @SubscribeEvent
    public static void gatherData(GatherDataEvent event)
    {
        DataGenerator datagen = event.getGenerator();
        if (event.includeServer()) {
            datagen.addProvider(new TutBlockStates(datagen, event.getExistingFileHelper()));
            TutBlockTags blockTags = new TutBlockTags(datagen, event.getExistingFileHelper());
            datagen.addProvider(blockTags);
            datagen.addProvider(new TutItemTags(datagen, blockTags, event.getExistingFileHelper()));
        }
        if (event.includeClient()) {
            datagen.addProvider(new TutBlockStates(datagen, event.getExistingFileHelper()));
            datagen.addProvider(new TutItemModels(datagen, event.getExistingFileHelper()));
            datagen.addProvider(new TutLanguageProvider(datagen, "en_us"));
        }
    }

}

But where?

6 minutes ago, LVUM said:

Weird... it doesnt generate any recipe at all... Do i have to call this class somewhere else in the project?

does the other providers work?
did you replace the mod id in the builde.gradle file (in the data run -> line 103) with yours?

  • Author

I solved one problem but another came out:

First I was missing the following code in the server side of DataGeneration

datagen.addProvider(new TutRecipes(datagen));

now at least TutRecipes tries to generate the recipes

but then when I generate the recipes doing runData I get this error:

Quote

Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException

...

Quote

Caused by: net.minecraft.ResourceLocationException: Non [a-z0-9/._-] character in path of location: minecraft:recipes/Rift/amethyst_gem1

How do I solve this?

  • Author

I am sure the problem is the upper 'R' but how can I change it to a lower 'r' ?

why on earth did you put your recipes into the minecraft data folder?
 

7 minutes ago, LVUM said:

I am sure the problem is the upper 'R' but how can I change it to a lower 'r' ?

you can't use upper case in a ResourceLocation, where did you use this ResourceLocation -> post full error

  • Author

I figured out where the error was and now its working. Thanks!

  • 1 month later...
11 minutes ago, DaSchmitt said:

I've got the exact same issue, how did you solve it?

I've solved it. For anyone looking around in the future, if you have a ModSetup.java class or anything like such which contains TAB_NAME, make sure it's value is set to something lower case. It could also be any of your other similar calls.

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.