Jump to content

Removing Recipe Fail[1.10.2]


Bloopers

Recommended Posts

I picked up a mod that I had been working on a couple months ago in 1.8 and updated it to 1.10.2. This mod just removed the bed recipe(and added my own, to make it harder to craft) - it worked perfectly in 1.8, but after I update to 1.10.2, it just does the normal bed recipe. This is how I removed the recipes(from a tutorial video)

 

package bloopers.harderbeds;

import java.util.Iterator;
import java.util.List;

import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;

public class RecipeRemover
{
public static void removeRecipe(Item item)
{

	List<IRecipe> recipies = CraftingManager.getInstance().getRecipeList();

	Iterator<IRecipe> remover = recipies.iterator();

	while (remover.hasNext())
	{
		ItemStack itemstack = remover.next().getRecipeOutput();

		if(itemstack != null && itemstack.getItem() == item)
		{
			remover.remove();
		}


	}

}

public static void removeRecipe(Block block)
{

	List<IRecipe> recipies = CraftingManager.getInstance().getRecipeList();

	Iterator<IRecipe> remover = recipies.iterator();

	while (remover.hasNext())
	{
		ItemStack itemstack = remover.next().getRecipeOutput();

		if(itemstack != null && itemstack.getItem() == Item.getItemFromBlock(block))
		{
			remover.remove();
		}


	}

}
}

 

Then, in my PostInit, I put this:

		RecipeRemover.removeRecipe(Items.BED);

 

 

 

Is there a new way to remove recipes, or is there something outdated in this code? Any help is appreciated!

Link to comment
Share on other sites

Was there a crash, or error printes out in the console, did the removing of the recipe just not work?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Was there a crash, or error printes out in the console, did the removing of the recipe just not work?

Actually, now that I look at it, the mod doesn't seem to load at all. It just says 3 mods loaded when I click run. (Mincraft Coder Pack, Forge Mod Loader and Minecraft Forge)

 

...and I found out what was happening, too! In my "acceptedMinecraftVersions" in the main mod file, I set it to: "[1.10],[1.10.1],1.10.2]"

 

For some reason, it doesn't like whatever I put in and acted as if the mod didn't exist at all. So instead, I replaced it with: "[1.10.2]" only. Now that I launch, the recipe is removed!

 

Do I really need to allow for 1.10, 1.10.1 and 1.10.2 to use this mod, or will it allow it anyway?

Link to comment
Share on other sites

In my "acceptedMinecraftVersions" in the main mod file, I set it to: "[1.10],[1.10.1],1.10.2]"

 

I doubt that's even a valid version set string.  It's supposed to be "[earliest],[latest]" and you have, not only 3 values there (instead of 2) but you're missing a [ on one of them.

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.

Link to comment
Share on other sites

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.