Jump to content

How to change vanilla recipe for wood planks? [1.12.2]


Recommended Posts

Posted (edited)

I'm trying to change the recipe for wooden planks in 1.12.2. Whenever I need to change the recipe for something, I remove the vanilla one and then add my own JSON file in assets. However, I'm having trouble removing the recipe for things with metadata. How do I remove the recipes for wood planks, for example? Here's the code I've been using:
I am unable to use replaceTheseRecipes.add(minecraft:oak_planks), and replaceTheseRecipes.add(minecraft:planks) doesn't work either. Any help is appreciated!

public static void removeRecipes() {
        ForgeRegistry<IRecipe> recipeRegistry = (ForgeRegistry<IRecipe>)ForgeRegistries.RECIPES;
        ArrayList<IRecipe> recipes = Lists.newArrayList(recipeRegistry.getValuesCollection());
        
        ArrayList<String> replaceTheseRecipes = Lists.newArrayList();
        replaceTheseRecipes.add("minecraft:stone_sword");
        replaceTheseRecipes.add("minecraft:stone_pickaxe");
        replaceTheseRecipes.add("minecraft:stone_axe");
        replaceTheseRecipes.add("minecraft:stone_shovel");
        replaceTheseRecipes.add("minecraft:stone_hoe");
        replaceTheseRecipes.add("minecraft:furnace");
        replaceTheseRecipes.add("minecraft:chest");
        replaceTheseRecipes.add("minecraft:stick");
        
        for (IRecipe r : recipes)
        {
            ItemStack output = r.getRecipeOutput();
            for (String replaceThisItem : replaceTheseRecipes) {
                
                Item itemToReplace = Item.getByNameOrId(replaceThisItem);
                if (output.getItem() == itemToReplace)
                {
                    System.out.println("The r.getRegistry name is: " + r.getRegistryName() + ". The Item.getRegistryName was: " + itemToReplace.getRegistryName());
                    if (r.getRegistryName().equals(itemToReplace.getRegistryName())) 
                    {
                        System.out.println("We're now removing the recipe for: " + r.getRegistryName());
                            recipeRegistry.remove(r.getRegistryName());
                            break;
                    } else 
                    {
                        System.out.println("We DIDN'T remove a suspiciously similar item: " + r.getRegistryName());
                    }
                }
            }
        }
    }
Edited by probe
Posted

1) I don't know why you're comparing strings instead of Items.

2) I don't know why you're not using data packs for this

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
1 minute ago, Draco18s said:

1) I don't know why you're comparing strings instead of Items.

2) I don't know why you're not using data packs for this

Thanks for the help? (Sarcasm)

The strings are temporary. I'm new to this whole thing and I'm still trying to figure everything out.

Posted

Well.

Why aren't you using data packs?

You create a recipe json in the minecraft asset directory and it will override the vanilla recipe.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
8 minutes ago, Draco18s said:

Well.

Why aren't you using data packs?

You create a recipe json in the minecraft asset directory and it will override the vanilla recipe.

I tried simply putting a recipe JSON in the assets package but it wouldn't change anything ingame unless I removed the vanilla recipe from the registry as well.

Posted (edited)

You have to put it in the minecraft folder of your assets. You can't just put it anywhere.

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
 
 
 
 
6 minutes ago, diesieben07 said:

Which part of this did you not understand?

Pretty much the whole thing.

9378f64f1fe6ad926ce1795761012371.png

a0ea8dd3d638c6a17b45f5bed1ca5bd9.png

 

I'm sorry that I sound so thick but I honestly can't figure this out.

 

 

Posted
 
 
 
 
 
3
15 minutes ago, diesieben07 said:

The recipe file must be in the exact same location that it has in vanilla minecraft.

Which is assets/minecraft/recipes.

That IS assets/minecraft/recipes. 0dcc15b4a0bd4e4b67ae5d2cd8824451.png

Posted
10 minutes ago, diesieben07 said:

That should work.

Is there anything in the log? If not, post a working Git repository of your mod.

Nothing in the log. Not sure if relevant but 

Item.getByNameOrId("minecraft:acacia_planks"));

returns null. Is this like a weird quirk of 1.12.2 or something? Last time I played minecraft was when number IDs were the only kind of IDs ._.

Gotta head to class but I'll see about a repository when I'm back.

Posted
31 minutes ago, probe said:

Is this like a weird quirk of 1.12.2 or something? Last time I played minecraft was when number IDs were the only kind of IDs ._.

You're looking for "minecraft:planks" with a metadata value of 4.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.