Scan entire inventory for item with certain tag

Started by FortniteChild1234 on

Topic category: Help with modding (Java Edition)

Last seen on 06:39, 1. Jul 2024
Joined May 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Scan entire inventory for item with certain tag

So currently, I have an issue where if an item is enchanted or damaged, it won't unlock an achievement. But, I have potentially found a way to fix this problem by using tags. The problem is, there isn't any block of code, or way I know, to check to see if an item in the player's inventory has an item with a certain tag certain tag. I was searching for ways to do this when I came across iterating through the inventory. But everything I tried didn't seem to work, it didn't unlock the achievement, and the procedures didn't even run, and now I've hit a wall. If someone could help me, I'd be very grateful!

 

Thanks in advance.

Make local variable found of…
Sat, 06/29/2024 - 14:18

Make local variable found of type logic

Set its value to false

Use for each item in player inventory block.

   for each item in the loop, check if it is tagged in desired tag

       if yes, set local variable found to true

 

if found

   do custom action

 

Name can be something else than found if you want to

 

I suggest you check our…
Sat, 06/29/2024 - 14:18

I suggest you check our tutorials collection playlist on our YouTube channel which contains many examples and tutorials that can help you get started with MCreator: https://www.youtube.com/playlist?list=PLAeL-oIFIEngE6jRgFYeFMfuj8WQsO3Ei