Jump to content

[1.15.2] Using Non-potion items as Potion Ingredients [Resolved]


izofar

Recommended Posts

Currently, I am using reflection to call Potions.addMix I want to be able to use the honey bottle as a base potion like I would water, awkward potions, etc. However, the HoneyBottleItem does not inherit from Potion. It seems that registered Potions have an item automatically generated for them, which I don't want because honey bottles already have an associated item. How can I, given a registered Potion HONEY, override it's item to be the honey bottle, so that I may use Potions.addMix(HONEY, ...)? Or, is there a better way to achieve this?

 

Edit: While I considered a custom class that extends the necessary superclasses, the BeehiveBlock class has a native method that returns the HoneyBottleItem during the appropriate event. This would cause trouble for me for I would have to create a custom beehive class then modify world-gen. I hope there's another way.

Edited by izofar
Link to comment
Share on other sites

6 hours ago, ChampionAsh5357 said:

I would recommend looking at BrewingRecipeRegistry#addRecipe.

Thanks! This seems to be supposed to do what I want, though when I call

BrewingRecipeRegistry.addRecipe(
	Ingredient.fromItems(Items.field_226638_pX_), 		//Honey Bottle Item (retrived from source)
	Ingredient.fromItems(Items.FERMENTED_SPIDER_EYE), 
	PotionUtils.addPotionToItemStack(new ItemStack(Items.SPLASH_POTION), Potions.WEAKNESS)

 

in-game, I still can't place honey bottles in the potion slot. Could this have to do with honey bottles not inheriting from minecraft.item.PotionItem?

 

To make sure, I have indeed checked that the method containing the above code is called with the rest of the registers (And with a debug output that shows up in the console).

Edited by izofar
Link to comment
Share on other sites

13 minutes ago, ChampionAsh5357 said:

No, I replicated the same process and it works fine. The item that you chose may not be the honey bottle, or you're call of the registry is not on both the client and server.

I see, in switching the honey bottle to Items.IRON_INGOT, it seems to work fine. This is interesting since in net.minecraft.item.Items, I read:

public static final Item field_226638_pX_ = register("honey_bottle", new HoneyBottleItem((new Item.Properties())
		.containerItem(GLASS_BOTTLE)
		.food(Foods.field_226604_w_)
		.group(ItemGroup.FOOD)
		.maxStackSize(16)));

Which appears to be the honey bottle. I will have to investigate this further, but this seemed to narrow down the issue, thank you!

Link to comment
Share on other sites

[FIXED] Silly me...

 

... when testing the code I last posted, I was attempting to place a stack of honey bottles instead of a single honey bottle...

 

Otherwise, it works fine. Thank you to all who replied.

  • Like 1
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.