How can I make it so that when an item is in the Hotbar, it gives the player an effect?

Started by lunakel_ on Sun, 09/27/2020 - 07:52

Topic category: Help with MCreator software

Last seen on 08:54, 28. Sep 2020
Joined Sep 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How can I make it so that when an item is in the Hotbar, it gives the player an effect?
Sun, 09/27/2020 - 07:52

How can I make it so that when an item is in the Hotbar, it gives the player an effect? Perhaps I made a mistake in the question, sorry my English is not very good

Last seen on 06:55, 27. Apr 2021
Joined Dec 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
You can do the procedure to…
Mon, 09/28/2020 - 19:29

You can do the procedure to check the hotbar slots and if the item exists give an effect. I'm not on my PC right now, if you don't or others don't, I'll send you a screenshot of what it looks like.

Last seen on 06:55, 27. Apr 2021
Joined Dec 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
0 through 8 are the hotbar…
Wed, 09/30/2020 - 03:35

item bonus

0 through 8 are the hotbar slots

Last seen on 02:26, 11. Sep 2021
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Rather than having to copy…
Wed, 07/14/2021 - 00:24

Rather than having to copy and paste the same thing 9 times like Kinyoshi suggests, you can actually just use a loop to check all the slots. Print statements added for clarity (they are not needed to work).

 

The way I demonstrate below also stops checking other slots if the item is already found, so that the game doesn't spend extra time looking

 

Loop to check all hotbar slot