Started by
Block_BoyZ
on
Topic category: Help with Minecraft modding (Java Edition)
I am trying to make an edible item that, when it has specific items from a tag used in the crafting recipe, will give a specific effect. Say I used a golden apple to craft my item. I would like that item to give me absorption, but only if the golden apple is used. If an rotten flesh is used instead, it should give the hunger effect. Is this possible?
Thanks!
The simplest way would be to create individual items/crafting recipes that when you eat them they do different effects.
If you're using tags, you would have to create a procedure checking the crafting table and manually setting the output. Then in a separate procedure, when food is eaten, if food has tag, do effect
How would I go about checking the crafting table?
Annoyingly, there's no easy way in MCreator to check for an open GUI of base game containers, only your custom ones. In order to do this, I have modified the MCreator code to add in the base game crafting table:
Add this in with the "custom code" block located under the "advanced" tab - https://imgur.com/LLdFbzs
You will need the event/target entity dependency in order for this code to work. If you have the event/target entity dependency already in your procedure, than you can use the custom code snippet like in the image above. If you do not have the dependency set up, just add any code block that has the event/target entity (it doesn't have to have a function. It's just there so the dependency pops up - https://imgur.com/AsYJkwf).
You can then use the "get item from slot [num] of currently open GUI of event/target entity. Here are the slot numbers - https://imgur.com/e5PAHx1
You will need an "if" statement to check that each slot has the correct item in it. There is also an option for "empty itemstack" for blank slots. Here is an example of a crafting recipe for a stone pickaxe - https://imgur.com/WG0HnSJ