How to get NBT data of item in player incentory

Started by nilek20 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to get NBT data of item in player incentory

I am trying to get NBT data from an item in the players inventory for a comparison in an if statement NOT in a procedure attached to the item. A more detailed explanation is that i am making a block that spawns a mob and then assigns it three "synced data variables". The three data points are also assigned to the block as NBT data. In that mobs "when entity takes damage" trigger i am making a procedure that will make the entity take extra damage if the play has the block that spawned the entity in their inventory, but i cant seem to figure out how to get the NBT data of the block (now an item) in the players inventory.

 

My question is how do i compare the data from the mob to the data from an item that will be in a random spot in the players inventory.