Jump to content

IRC / Recipes


Zedicus

Recommended Posts

Two questions, a) Why do I get the message 'Cannot send to channel: #minecraftforge' I'm fairly sure my account's registered on IRC, etc.

And an actual modding question - b) How would you go about removing a vanilla recipe, not asking for all the code unless it's one line, just removes some of the fun if someone else writes your mod for you, haha, just curious If I'm required to write an event or if there's a more simple way. ;)

 

Thanks,

Zed!

Link to comment
Share on other sites

Rather than posting a new thread I thought to add it here -

 

Main Class - PostInit:

 

 @PostInit
public void PostInit(FMLPostInitializationEvent event) {

 RecipeRemover.RecipeRemoval();

}

 

Actual method in RecipeRemover:

	public static void RecipeRemoval(){
List RecipeList = CraftingManager.getInstance().getRecipeList();
int ListSize = RecipeList.size();

for(int i = 0; i < ListSize; i++) {
	Object o = RecipeList.get(i);
	System.out.println("check");
	if(o == (new ItemStack(Item.brewingStand))) {
		System.out.println("RECIPE REMOVED");
		RecipeList.remove(i);
	}
}
}

 

I'm sure I've made a stupid mistake somewhere along there, but my main issue is how to I tell which recipe's which, a.k.a. the:

		if(o == (new ItemStack(Item.brewingStand))) {

Part.

 

Thanks.

 

(It should be noted that the method doesn't appear to be getting called at all, I did some tests with System.out's and it returned nothing on start up, other than the preinit posting a string, the init registered an item but wouldn't 'post' a string, leading to some confusion about when the methods 'fire', so to speak.)

Link to comment
Share on other sites

You're going to want to keep  the crafting manager's list 'safe' since the code is run both on integrated and client threads, that is to say say to prevent dual thread access errors you'll need

List<IRecipe> l = new ArrayList<IRecipe>();
l.addAll(CraftingManager.instance.getRecipeList());

then iterate the list l to find recipes which have outcomes matching Item.brewingStand

Then use

CraftingManager.instance.getRecipeList().remove(recipe/*the recipe you grabbed through itsra */);

I think its my java of the variables.

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.