I have been trying to get this command to trigger when I have a piece of dirt in the first slot but it hasn't worked.
/execute if block ~ ~ ~ minecraft:chest{Items:[{id:"dirt",Slot:0,Count:1}]} run say hi
I've tried this so far but it just won't work. Any ideas?
Edit: There's another post with an answer but it uses /testforblock which isn't a valid command anymore.