Posted May 11, 20196 yr 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
May 11, 20196 yr 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.
May 11, 20196 yr 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()); } }
May 11, 20196 yr 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
May 11, 20196 yr 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 Thank you very much
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.