29: Detect item in inventory [Minecraft Map Making]

Subscribers:
4,230
Published on ● Video Link: https://www.youtube.com/watch?v=wCi9D5T-a5I



Minecraft
Game:
Minecraft (2011)
Duration: 10:30
295 views
15


Ep29: Detecting a specific item in the players inventory.

Originally for Udemy, but uploaded here.
Commands, builds and ideas for people making their own Minecraft maps.

Check out my collabs on Coppit's channel: https://www.youtube.com/c/CoppitJ

Join the server I play on and the Discord where I hang out.
Server IP: 51.81.246.145:25588
Discord: https://discord.gg/KNSmPWdnfG

Udemy notes. YouTube formatting may make some of these wrong. :)

Commands used:
Close the door:
setblock -13 56 40 white_wool replace

Detect item:
execute as @a if entity @s[x=-16,y=56,z=39,distance=0..1,nbt={Inventory:[{id:"minecraft:tripwire_hook", Count:1b}]}] run setblock -13 56 40 redstone_block replace

Detect item that has been renamed in an anvil:
execute at @a[x=-16,y=56,z=39,distance=0..1,nbt={Inventory:[{id:"minecraft:tripwire_hook", Count:1b, tag:{display:{Name:'{"text":"Door Key"}'}}}]}] run setblock -13 56 40 redstone_block replace



execute as @a if entity @s[nbt={Inventory:[{id:"minecraft:tripwire_hook", tag:{myHook:1b}}]}] run say You have the item!
give @p minecraft:tripwire_hook{myHook:1b}


give @p minecraft:tripwire_hook{display:{Name:'{"text":"Dungeon Key"}'}}
give @p minecraft:tripwire_hook{display:{Lore:['{"text":"It opens the dungeon door."}'],Name:'{"text":"Dungeon Key"}'}}


clear @p minecraft:tripwire_hook{myHook:1b}
clear @p minecraft:tripwire_hook{myHook:1b} 1







Tags:
minecraft
adventure map
map making
commands
command blocks
1.16
1.17
1.18
custom commands
redstone
map ideas
map suggesstions
custom maps



Other Statistics

Minecraft Statistics For Infernal Device

At present, Infernal Device has 184,447 views spread across 877 videos for Minecraft, accounting for over 10 days of watchable video on his channel. This is 94.82% of the total watchable video for Minecraft on Infernal Device's YouTube channel.