Adding potion effects to an item when created in output slot in custom block.

Started by luca2838 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Oct 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Adding potion effects to an item when created in output slot in custom block.

I am using MCreator 2024.4

I have been trying to search everywhere for an answer for this.

I am currently trying to do something like this:
I have figured out how to add the item, fluids etc but I need to figure out how to add effects to the player when the item is eaten, the effects and effect duration needs to change depending on what type of fruit is being put into the item.

I think i need to somehow add a custom NBT tag or custom data number to the item in the output slot of my custom block, but i have no idea how that would be done, and whatever i try does not work at all.

For an example:


If i mix 1 strawberry and milk i get a strawberry milkshake that gives me regen 1 for 1 second
If i then add 3 strawberries more to the milkshake, that milkshake now gives me regen 1 for 4 seconds instead.

 

I cannot for the life of me find out how to add either a custom number tag, or an NBT tag to the milkshake in the output slot of my item when it is consuming strawberries.

I figured out how to add custom data number tags to the item to give regen for a duration based on the value. But i have absolutely no idea on how to add that custom data number tag to an item in the output slot of my custom block.

I am very new to minecraft modding and do not know fixes to a lot of things. If any of you have a way to do this if possible i would love it if you could share how exactly and with which blocks it should be done. Thank you!