Hey folks! So I summoned an item with a tag "evilmilk." If I don't pick it up and run kill @e[tag:evilmilk] the item is killed as expected. If I summon the item again and pick it up then drop it again; I run the kill command again and it doesn't get killed. How do I stop the item from losing it's "evilmilk" tag?
Tags generated using /tag only apply to entities. Dropped items are considered entities so they are able to hold the tag but they become regular items once picked up.
So I was wise then giving it a custom tag of evilmilk:1b. The issue came about because I want to have the player drop the item on a specific block and I was trying to execute a command as that item if the block was ~ ~-1 ~ and it wasn't working out. Which made me try detecting the evilmilk tag.
I just tried this but it's doing nothing:
execute as @e[type=minecraft:item,nbt={Item:{tag:{evilkmilk:1b}}}] at @s if block ~ ~-1 ~ minecraft:chiseled_stone_bricks run say hi
So I was wise then giving it a custom tag of evilmilk:1b. The issue came about because I want to have the player drop the item on a specific block and I was trying to execute a command as that item if the block was ~ ~-1 ~ and it wasn't working out. Which made me try detecting the evilmilk tag.
I just tried this but it's doing nothing:
execute as @e[type=minecraft:item,nbt={Item:{tag:{evilkmilk:1b}}}] at @s if block ~ ~-1 ~ minecraft:chiseled_stone_bricks run say hi
Good catch. Thanks. However, it's still not seeing it. Here's the give command that executes if the player drinks the milk:
execute as @a at @s run summon minecraft:item ~ ~ ~ {NoGravity:1b,Age:-32768,Tags:["evilmilk"],Item:{id:"minecraft:milk_bucket",Count:1b,tag:{display:{Name:'{"text":"Warm Milk Of Chaotic Doom","color":"dark_red","bold":true,"italic":true}',Lore:['{"text":"Milk from the Udders of Evil.","color":"white","italic":true}']},HideFlags:63,evilmilk:1b,Enchantments:[{id:"minecraft:thorns",lvl:10s},{id:"minecraft:sharpness",lvl:10s},{id:"minecraft:smite",lvl:10s},{id:"minecraft:knockback",lvl:10s},{id:"minecraft:efficiency",lvl:10s},{id:"minecraft:unbreaking",lvl:10s},{id:"minecraft:power",lvl:10s},{id:"minecraft:punch",lvl:10s},{id:"minecraft:flame",lvl:10s}]}}}
The item is detected in the player's inventory without issue with this command:
execute as @a[nbt={Inventory:[{tag:{evilmilk:1b}}]}] run setblock -16 39 23 minecraft:redstone_block replace
Before/if the player drinks the milk, the item is summoned on the map with this:
summon minecraft:item -11 34 36 {NoGravity:1b,Age:-32768,Tags:["evilmilk"],Item:{id:"minecraft:milk_bucket",Count:1b,tag:{display:{Name:'{"text":"Warm Milk Of Chaotic Doom","color":"dark_red","bold":true,"italic":true}',Lore:['{"text":"Milk from the Udder of Evil.","color":"white","italic":true}']},HideFlags:63,evilmilk:1b,Enchantments:[{id:"minecraft:thorns",lvl:10s},{id:"minecraft:sharpness",lvl:10s},{id:"minecraft:smite",lvl:10s},{id:"minecraft:knockback",lvl:10s},{id:"minecraft:efficiency",lvl:10s},{id:"minecraft:unbreaking",lvl:10s},{id:"minecraft:power",lvl:10s},{id:"minecraft:punch",lvl:10s},{id:"minecraft:flame",lvl:10s}]}}}
Neither the summon or give items are being detected with:
execute as @e[type=minecraft:item,nbt={Item:{tag:{evilkmilk:1b}}}] at @s if block ~ ~-1 ~ minecraft:chiseled_stone_bricks run say hi
Sorry for the book and thanks for helping out.
Not sure why the b /b is in there...but ok. Just ignore those.
Never mind...I'm a goof. I forgot I had changed the command in game to something similar that most certainly should not have worked and forgot to change it back. I does indeed work.
Hey folks! So I summoned an item with a tag "evilmilk." If I don't pick it up and run kill @e[tag:evilmilk] the item is killed as expected. If I summon the item again and pick it up then drop it again; I run the kill command again and it doesn't get killed. How do I stop the item from losing it's "evilmilk" tag?
Tags generated using /tag only apply to entities. Dropped items are considered entities so they are able to hold the tag but they become regular items once picked up.
I recommend using a custom item tag instead:
Command block engineer // Developer // #TeamTrees
So I was wise then giving it a custom tag of evilmilk:1b. The issue came about because I want to have the player drop the item on a specific block and I was trying to execute a command as that item if the block was ~ ~-1 ~ and it wasn't working out. Which made me try detecting the evilmilk tag.
I just tried this but it's doing nothing:
execute as @e[type=minecraft:item,nbt={Item:{tag:{evilkmilk:1b}}}] at @s if block ~ ~-1 ~ minecraft:chiseled_stone_bricks run say hi
What's your give command?
==Links==
๐๐๐๐จ๐ง๐ ๐๐ก๐๐ง๐ง๐๐ฅ- https://www.youtube.com/channel/UCQYroXqdZtYBnyspneetBGA/featured
๐๐ง๐ฌ๐ญ๐๐ ๐ซ๐๐ฆ- https://www.instagram.com/cowsdabest_yt/?hl=en
๐๐ฐ๐ข๐ญ๐ญ๐๐ซ- https://twitter.com/cowsdabestyt
๐๐ข๐ฌ๐๐จ๐ซ๐- https://discord.gg/H2NfhpQ
==DISCLAIMER!==
Please credit me if you are going to use it in a video or a map!
The command works fine but I noticed that your tag has an extra 'k'. Maybe you typed it wrong in your /give command?
Command block engineer // Developer // #TeamTrees
Good catch. Thanks. However, it's still not seeing it. Here's the give command that executes if the player drinks the milk:
execute as @a at @s run summon minecraft:item ~ ~ ~ {NoGravity:1b,Age:-32768,Tags:["evilmilk"],Item:{id:"minecraft:milk_bucket",Count:1b,tag:{display:{Name:'{"text":"Warm Milk Of Chaotic Doom","color":"dark_red","bold":true,"italic":true}',Lore:['{"text":"Milk from the Udders of Evil.","color":"white","italic":true}']},HideFlags:63,evilmilk:1b,Enchantments:[{id:"minecraft:thorns",lvl:10s},{id:"minecraft:sharpness",lvl:10s},{id:"minecraft:smite",lvl:10s},{id:"minecraft:knockback",lvl:10s},{id:"minecraft:efficiency",lvl:10s},{id:"minecraft:unbreaking",lvl:10s},{id:"minecraft:power",lvl:10s},{id:"minecraft:punch",lvl:10s},{id:"minecraft:flame",lvl:10s}]}}}
The item is detected in the player's inventory without issue with this command:
execute as @a[nbt={Inventory:[{tag:{evilmilk:1b}}]}] run setblock -16 39 23 minecraft:redstone_block replace
Before/if the player drinks the milk, the item is summoned on the map with this:
summon minecraft:item -11 34 36 {NoGravity:1b,Age:-32768,Tags:["evilmilk"],Item:{id:"minecraft:milk_bucket",Count:1b,tag:{display:{Name:'{"text":"Warm Milk Of Chaotic Doom","color":"dark_red","bold":true,"italic":true}',Lore:['{"text":"Milk from the Udder of Evil.","color":"white","italic":true}']},HideFlags:63,evilmilk:1b,Enchantments:[{id:"minecraft:thorns",lvl:10s},{id:"minecraft:sharpness",lvl:10s},{id:"minecraft:smite",lvl:10s},{id:"minecraft:knockback",lvl:10s},{id:"minecraft:efficiency",lvl:10s},{id:"minecraft:unbreaking",lvl:10s},{id:"minecraft:power",lvl:10s},{id:"minecraft:punch",lvl:10s},{id:"minecraft:flame",lvl:10s}]}}}
Neither the summon or give items are being detected with:
execute as @e[type=minecraft:item,nbt={Item:{tag:{evilkmilk:1b}}}] at @s if block ~ ~-1 ~ minecraft:chiseled_stone_bricks run say hi
Sorry for the book and thanks for helping out.
Not sure why the b /b is in there...but ok. Just ignore those.
Never mind...I'm a goof. I forgot I had changed the command in game to something similar that most certainly should not have worked and forgot to change it back. I does indeed work.