Jump to content

Recommended Posts

Posted

Hey guys,

I tried something to remove a Vanilla recipe

 

public static void removeRecipes() {
        
             ForgeRegistry<IRecipe> FR = (ForgeRegistry<IRecipe>)ForgeRegistries.RECIPES;
            //ArrayList<IRecipe> recipes = new ArrayList(recipeRegistry.getValues());
            for(IRecipe r : FR) {
                ItemStack I = r.getRecipeOutput();
                if(I != null && I.getItem() == Item.getItemFromBlock(Blocks.CRAFTING_TABLE)) {
                    FR.remove(FR.getKey(r));
                }
            }
    }

 

bud sadly that dont work, i tried a lot of other ways and i searched a lot around the internet and found things like "Craftingmager.getInstance" but that seems only to work for 1.7 :C so does anybody know a solution to that problem? I would be Happy

Posted

Wrong subforum.

Don't remove while iterating like that. In most cases you would crash with a CME.

 

Don't access a registry like that.

Remove the recipes during the appropriate registry event.

 

8 minutes ago, Schleim_time said:

I != null

This will always be true.

 

Remove the recipes based on their registry name, not their output.

Posted
58 minutes ago, Schleim_time said:

Thank you for your responce, im sorry for the whrong subforum

I got that to remove all crafting recepies, but i dont know how to get something out of the Irecipe to find out which one is the right to remove :C

 

 

@SubscribeEvent
    public static void onRecipeRegister(RegistryEvent.Register<IRecipe> e) {
         ForgeRegistry<IRecipe> FR = (ForgeRegistry<IRecipe>)ForgeRegistries.RECIPES;
         ArrayList<IRecipe> recipe = new ArrayList(FR.getValues());
         for(IRecipe r : recipe) {
             //if(r.toString().contains("wood")) {
             FR.remove(r.getRegistryName());
            
         }
         
    }

 

Posted
13 minutes ago, Schleim_time said:

r.toString().contains("wood")

...Why? I told you to remove the recipes based on their registry name. Why are you turning it into a string?

You are even getting said registry name a line lower

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.