Determing Items used in crafting

Started by Block_BoyZ on

Topic category: Help with Minecraft modding (Java Edition)

Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Determing Items used in crafting

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!

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The simplest way would be to…
Sun, 09/24/2023 - 02:58

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

Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How would I go about…
Sun, 09/24/2023 - 14:26

How would I go about checking the crafting table?

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Annoyingly, there's no easy…
Sun, 09/24/2023 - 16:03

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:

entity instanceof Player _plr ? _plr.containerMenu instanceof CraftingMenu : true

 

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).

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can then use the "get…
Sun, 09/24/2023 - 16:03

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