1

Execute on tagged entity

hogbits's Avatar hogbits10/13/21 11:37 pm
1 emeralds 330 2
10/14/2021 2:01 am
hogbits's Avatar hogbits
Okay I've pulling my hair out because I cannot for the life of me figure out how to execute a command if an entity has a tag. This seems like such a basic function yet I am too stupid to figure it out.

Below are two sets of commands written almost exactly except one uses type=chicken and one uses tag=test

# Failed Attempts to teleport
execute as @e[tag=test] run teleport ~ -500 ~
teleport @e[tag=test] ~ ~-500 ~
execute if entity @e[tag=test] run tp @e[tag=test] ~ ~-500 ~
tp @e[tag=test] @s

# Teleportation works
execute as @e[type=chicken] run teleport ~ -500 ~
teleport @e[type=chicken] ~ ~-500 ~
execute if entity @e[type=chicken] run tp @e[type=chicken] ~ ~-500 ~
tp @e[type=chicken] @s

All I want to do is teleport a chicken into the void if it has the tag of test.
Posted by hogbits's Avatar
hogbits
Level 34 : Artisan Pig
20

Create an account or sign in to comment.

2

HoboMaggot
10/14/2021 12:27 am
Level 52 : Grandmaster Blob
HoboMaggot's Avatar
Does your mob actually have the test tag? You can check using /tag <selector> list
Other than that, the commands you provided would work
2
hogbits
10/14/2021 2:01 am
Level 34 : Artisan Pig
history
hogbits's Avatar
Yes I confirmed the mob has that tag two ways.
  1. using /tag <selector> list
  2. using /data get <selector>
EDIT:
I reloaded the world after taking a break and watching a show and what do you know the command is now working correctly. I guess I should have followed the golden rule. "When in doubt, power out"

Thanks for the sanity check!
2
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome