How can I check if the item in a slot is a specific potion in MCreator 2025.2?

Started by Kaanatorium on

Topic category: Help with Minecraft modding (Java Edition)

Joined Oct 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How can I check if the item in a slot is a specific potion in MCreator 2025.2?

Hey everyone,
I’m working on my mod in MCreator 2025.2 (NeoForge 1.21.1).
Right now, I’m trying to check if the item inside a specific slot (for example slot 1 of a custom GUI) is a specific potion, like a Potion of Healing.

Here’s what I tried so far in a procedure:

Question:
👉 What’s the correct way in MCreator to check if an item in a slot is a specific potion (e.g. minecraft:healing)?
Do I need to use tags, NBT, or some built-in function?

Thanks in advance for any help! 🙏

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
this block is probably what…
Mon, 10/27/2025 - 12:34

this block is probably what you're looking for,

Joined Oct 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
this block is probably what…
Mon, 10/27/2025 - 21:17

this block is probably what you're looking for,

This doesn't exactly work, even if it's another potion, it works when I use it like this. For example, it also works on poison potions even though I selected swiftness.

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh yeah I see, try this, i…
Tue, 10/28/2025 - 00:29

Oh yeah I see, try this, i hope it works in 1.21.1 i only have 1.21.4 right now.

potion.getComponents().get(DataComponents.POTION_CONTENTS).is(Potions.AWKWARD)

change the AWKWARD part to the potion you want it can be,

Joined Oct 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
When I tried it without the…
Tue, 10/28/2025 - 00:48

When I tried it without the red block, I got the following error. If the red block isn’t just for display, I have a question — how can I select the “Local:potion” option? It appears empty when I click on it.

Task :compileJava FAILED
C:\...\procedures\AddPotionTimeProcedure.java:10: error: cannot find symbol if (potion.getComponents().get(DataComponents.POTION_CONTENTS).is(Potions.AWKWARD)) {
^
symbol: variable potion
location: class AddPotionTimeProcedure
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler output below.
C:\...\procedures\AddPotionTimeProcedure.java:10: error: cannot find symbol if (potion.getComponents().get(DataComponents.POTION_CONTENTS).is(Potions.AWKWARD)) {
^
symbol: variable potion
location: class AddPotionTimeProcedure
1 error
* Try:
> Check your code and dependencies to fix the compilation error(s)
> Run with --scan to get full insights.
BUILD FAILED in 636ms
6 actionable tasks: 1 executed, 5 up-to-date
Configuration cache entry reused.

BUILD FAILED

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
it's a local variable you…
Tue, 10/28/2025 - 09:29

it's a local variable you make them here, in this case it has to be an itemstack called potion.

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
after making the variable…
Tue, 10/28/2025 - 09:30

after making the variable you have to grab a new variable block from the Custom variables tab

Joined Oct 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This method didn’t work…
Tue, 10/28/2025 - 18:40

This method didn’t work either, I think I’ll try a different approach, but thank you anyway.

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
this worked for me can you…
Tue, 10/28/2025 - 19:17

this worked for me can you show me your procedure?

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
did you change the custom…
Tue, 10/28/2025 - 19:31

did you change the custom code snippet?

Joined Oct 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
No, i don't. potion…
Tue, 10/28/2025 - 19:36

No, i don't.

potion.getComponents().get(DataComponents.POTION_CONTENTS).is(Potions.AWKWARD)

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
and you don't get any errors…
Tue, 10/28/2025 - 19:38

and you don't get any errors when you use it?

Joined Oct 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
No, when I use it, the game…
Tue, 10/28/2025 - 19:39

No, when I use it, the game closes and gives an error.

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
and the error is..?
Tue, 10/28/2025 - 19:41

and the error is..?