Jump to content

Recommended Posts

Posted

I'm very new to modding (this is my first mod), so sorry if this seem stupid. 

I'm using data generators to generate my recipes and whenever I run them it doesn't give any errors, but it also fails to generate the recipes.

 

My Code: 

package net.Pinary_Pi.my1stmod.data.recipes;

 

import java.util.function.Consumer;

import net.minecraft.data.IFinishedRecipe;

import net.minecraft.data.RecipeProvider;

import net.Pinary_Pi.gear.item.CraftingItems;

import net.Pinary_Pi.my1stmod.setup.ModItems

import net.Pinary_Pi.my1stmod.setup.ModTags;

import net.minecraft.data.DataGenerator;

import net.minecraft.data.ShapedRecipeBuilder;

 

public class ModRecipesProvider extends RecipeProvider {

    public ModRecipesProvider(DataGenerator generatorIn) {

        super(generatorIn);

    }

    

    @Override

    protected void registerRecipes(Consumer<IFinishedRecipe> consumer) {

        ShapedRecipeBuilder.shapedRecipe(CraftingItems.STORAGE_BLOCKS_SILVER)

        .key('#', ModTags.Items.INGOTS_SILVER)

        .patternLine("###")

        .patternLine("###")

        .patternLine("###")

        .addCriterion("has item", hasItem(ModTags.Items.INGOTS_SILVER))

        .build(consumer);

        

        ShapedRecipeBuilder.shapedRecipe(CraftingItems.INGOTS_SILVER, 9)

        .key('#', ModTags.Items.STORAGE_BLOCKS_SILVER)

        .patternLine("#")

        .addCriterion("has item", hasItem(ModTags.Items.STORAGE_BLOCKS_SILVER))

        .build(consumer);

    }

}

 

I'm pretty sure I need to change the CraftingItems to something different, but everything else I put there causes an error that says "The method shapedRecipe(IItemProvider, int) in the type ShapedRecipeBuilder is not applicable for the arguments (RegistryObject<Item>, int). " I know I need to do something with IItemProvider, but I don't know how.

 

CraftingItems is a library that someone named SilentChaos512 made that I saw him using in his mods; I tried to copy what he did with it and put it in my mod. I'm pretty sure I'm not using it correctly.

Posted
3 hours ago, poopoodice said:

RegistryObject is a supplier that holds an item, use Supplier#get to get the Item where has already implemented IItemProvider.

TYSSSM!! It means a lot to me that you helped!

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.