How to tag a #log in 1.18?
-
I'm working on a treeAxe using commands in 1.18, but I can't figure out how to tag items that are logs and wood.
Here is what have so far:tag @e[type=item,nbt={item:{id:"minecraft:acacia_log"}}] add log
-
This is the command:
execute as @e[type=item,nbt={Item:{id:"minecraft:oak_log"}}] unless entity @s[tag=log] run tag @s add log
This command will detect any item that is of type
oak_log
, so you would need to repeat this one for every log type.The
unless
part makes the command block only add the tag to logs that aren't tagged already, reducing lag.