Jump to content

[1.15.2] How to make items usable inside the brewing stand


Recommended Posts

Posted

Hi! I'm really new to modding. I've been trying new things and I was wanting to add new recipes to the brewing stand. I've added in a recipe using this code: 

public void init(FMLCommonSetupEvent event) {
		try {
			Class clazz = net.minecraft.potion.PotionBrewing.class;
			Method mth = ObfuscationReflectionHelper.findMethod(clazz, "func_193357_a", Potion.class, Item.class, Potion.class);
			mth.invoke(null, Potions.EMPTY, BismuthChunkItem.block, MoltenBismuthBottle1Item.block);
			// To add more recipes, you can copy the line above, for ex.
			// mth.invoke(null, potion2, item2, potion3);
		} catch (Throwable e) {
			System.err.println("ERROR: " + e); // You can change this part
		}
	}

Now, I'm not sure if this is exactly taboo of me or telling of my newbie status to modding, but I'm using MCreator for creating this mod, and this code wasn't actually written by me, it was copied from a forum post for MCreator modding. Now, I actually have a decent amount of experience with coding, with Javascipt, Python, C, C#, and a C variant called GML. I've never used Java outside of programming mods for Minecraft, and like I said I'm new to that.

This code raises no errors, and builds correctly and runs, but the problem is that I can't actually put the Bismuth Chunk item into the ingredient slot in the brewing stand GUI, nor can I put an empty glass bottle into the potion slot in the brewing stand GUI. I've tried replacing "Potions.EMPTY" with "Items.GLASS_BOTTLE", but neither work.

Having next to no experience coding these things, I don't know where to go from here.

I'd really appreciate any help I can get with this.

Posted

MCreator is not supported on this forum. It is completely recommend that you take the time to learn java properly before coding as it is a semi-variation on C languages.

To answer your question though, Potion recipes should be registered through BrewingRecipeRegistry.

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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