Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

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.

  • Author
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());
            
         }
         
    }

 

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

  • Author

It wasnt that hard at end i did

if(r.getRegistryName().toString() == "minecraft:book") {

and that was all, wow and i tried everything else expect that xD

Thank you very much :D

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.