Posted December 20, 20213 yr 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.
December 20, 20213 yr 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...
December 20, 20213 yr 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?
December 20, 20213 yr 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?
December 20, 20213 yr 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?
December 20, 20213 yr Author I am sure the problem is the upper 'R' but how can I change it to a lower 'r' ?
December 20, 20213 yr 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
January 21, 20223 yr 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.