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

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?

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • https://gist.github.com/Jayv6/7e39a9c1b3eb10b0d5d76442718d80e0
    • Hey Harry007! I recently created a server called Classic Skies. It is an amazing skyblock server. Here is the information: Are you tired of “modern” skyblock servers that are nothing like the original? Are you looking for a skyblock server that is just like the original skyblock servers used to be? So was I, but I couldn't find one, so, I decided to make my own.   Many modern servers have mutated the Skyblock game mode to the point where it is unrecognizable compared to the original. We are seeking to create a space where those who loved classic Skyblock can enjoy the original game mode. Even if you have not played classic Skyblock before, we encourage you to join our community to learn about what the original mode was like and why there was so much excitement around it.   Server Description Classic Skies is designed just like the original skyblock servers but in the modern version, 1.19.4. There is a server shop where you can buy some of the items that you can’t obtain naturally with in-game money, as well as a plugin that allows you to set up your own shops on your island, causing a mostly player-run economy. Classic Skies’ goal is to bring back the nostalgic and classic feel of the original Skyblock as much as possible. We have a dedicated staff team and an owner with years of experience running small to medium-sized Minecraft servers. Classic Skies is a small server with a tight-knit community, and we are looking for new members to enjoy our server. Additionally, we are dedicated to delivering a lag-free, fair, and safe experience for every member of the community.   Server Info Server IP: play.classicskies.com Supports Java & Bedrock Edition Bedrock Port: 19132 Game Version: 1.19.4 Discord: https://discord.gg/n7qXHnhksA
    • I am trying to override or disable some vanilla recipes, as part of my mod. All of the methods that I have seen online, so far, do not work. So far, I have tried: Creating a JSON file in the "data/minecraft/recipes" folder, that has air as the ingredient and a barrier as the result This only works for crafting table recipes adding a smelting recipe this way works as intended Editing the ordering to AFTER in the forge dependency inside the "mods.toml" file Found an older post about using the FurnaceRecipe class, that no longer exists From: here So, what is required to disable a vanilla smelting recipe? I know some may say to not do this, but part of the progression of my mod kind of requires disabling some of the furnace recipes. Also, it seems that smelting recipes don't technically have to have the same filename as the block used, r as the result. When overriding crafting recipes, just adding the edited/removed recipe file in the minecraft data folder, under the same name as the original recipe.  Edit: the crafting recipes seem to be cached between worlds? I created a new world and the edited crafting recipes works, but it doesn't work in an already made world?
    • Using a modified version of "Fabulously Optimized" installed a few more mods and now my Hot Bar is invisible... Latest log : https://paste.ee/p/72TSs (No DeBug log txt file.)
    • I know that with this you can return the game folder   FMLPaths.GAMEDIR.get() I want the player to be created in the world where a txt file was created in the folder of the same world. How can I return the path of the world folder that the player is in?
  • Topics

×
×
  • Create New...

Important Information

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