Jump to content

Smelting Minecraft Items to a Moded Item [HELP] [1.18.1]


LVUM

Recommended Posts

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

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.

Announcements



×
×
  • Create New...

Important Information

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