Skip to main content
Added some more information to make the answer more useful
Source Link
user232393
user232393

Skip to the edit for the best solution if you don´t care about technical details, or previous solutions, the edit has the best solution

Cows (And many other mobs) have an NBT-tag called Age, when the cow is born this tag has a value of -24000 and the cow grows up when it reaches 0 and it stays at 0.

When cows breed their age is set to 6000 and it counts down until it reaches 0 again. Cows can not breed unless their age is 0.

There is no way to check if the Age-tag is lower than 0, you can only check for specific values. This means that you can´t teleport all baby cows and no grown up cows, unless you use 24000 commands, one for every possible age of a baby.

You can however use this command to teleport any cow that was born that tick:

/tp @e[nbt={Age:-24000},type=cow] <destination>

You can use this command to teleport all baby cows and all cows that can´t breed yet:

/tp @e[nbt=!{Age:0},type=cow] <destination>

Alternatively you can tag all your grown up cows with /tag @e[nbt={Age:0},type=cow] add grownUp, before you breed them and then you teleport all cows that don´t have that tag:

/tp @e[type=cow,tag=!grownUp] <destination>

This command would work, but it is too long for a command block, so there is no way to execute it in the game:

/execute as @e[type=cow] unless data entity @s {Age:0} unless data entity @s {Age:1} unless data entity @s {Age:2} <continue this for a while> unless data entity @s {Age:5999} unless data entity @s {Age:6000} run tp <destination>

The command length in command blocks is capped at 32767, this command would have a length of about 180000.

Edit:

Set up a scoreboard objective:

/scoreboard objectives add cowAge dummy

Then you run this command in a repeating command block. It will set the score of every cow to whatever value the Age-tag currently has. (It would be enough to run this command once right before you want to teleport the babies, maybe in an impulse command block that triggers a chain command block with the /tp command from further down)

/execute as @e[type=cow] store result score @s cowAge run data get entity @s Age 1

After using that command you can teleport all baby cows with this command, it teleports every cow with a cowAge-score of -1, or lower:

/tp @e[type=cow,scores={cowAge=..-1}] <destination>

Cows (And many other mobs) have an NBT-tag called Age, when the cow is born this tag has a value of -24000 and the cow grows up when it reaches 0 and it stays at 0.

When cows breed their age is set to 6000 and it counts down until it reaches 0 again. Cows can not breed unless their age is 0.

There is no way to check if the Age-tag is lower than 0, you can only check for specific values. This means that you can´t teleport all baby cows and no grown up cows, unless you use 24000 commands, one for every possible age of a baby.

You can however use this command to teleport any cow that was born that tick:

/tp @e[nbt={Age:-24000},type=cow] <destination>

You can use this command to teleport all baby cows and all cows that can´t breed yet:

/tp @e[nbt=!{Age:0},type=cow] <destination>

Alternatively you can tag all your grown up cows with /tag @e[nbt={Age:0},type=cow] add grownUp, before you breed them and then you teleport all cows that don´t have that tag:

/tp @e[type=cow,tag=!grownUp] <destination>

This command would work, but it is too long for a command block, so there is no way to execute it in the game:

/execute as @e[type=cow] unless data entity @s {Age:0} unless data entity @s {Age:1} unless data entity @s {Age:2} <continue this for a while> unless data entity @s {Age:5999} unless data entity @s {Age:6000} run tp <destination>

The command length in command blocks is capped at 32767, this command would have a length of about 180000.

Skip to the edit for the best solution if you don´t care about technical details, or previous solutions, the edit has the best solution

Cows (And many other mobs) have an NBT-tag called Age, when the cow is born this tag has a value of -24000 and the cow grows up when it reaches 0 and it stays at 0.

When cows breed their age is set to 6000 and it counts down until it reaches 0 again. Cows can not breed unless their age is 0.

There is no way to check if the Age-tag is lower than 0, you can only check for specific values. This means that you can´t teleport all baby cows and no grown up cows, unless you use 24000 commands, one for every possible age of a baby.

You can however use this command to teleport any cow that was born that tick:

/tp @e[nbt={Age:-24000},type=cow] <destination>

You can use this command to teleport all baby cows and all cows that can´t breed yet:

/tp @e[nbt=!{Age:0},type=cow] <destination>

Alternatively you can tag all your grown up cows with /tag @e[nbt={Age:0},type=cow] add grownUp, before you breed them and then you teleport all cows that don´t have that tag:

/tp @e[type=cow,tag=!grownUp] <destination>

This command would work, but it is too long for a command block, so there is no way to execute it in the game:

/execute as @e[type=cow] unless data entity @s {Age:0} unless data entity @s {Age:1} unless data entity @s {Age:2} <continue this for a while> unless data entity @s {Age:5999} unless data entity @s {Age:6000} run tp <destination>

The command length in command blocks is capped at 32767, this command would have a length of about 180000.

Edit:

Set up a scoreboard objective:

/scoreboard objectives add cowAge dummy

Then you run this command in a repeating command block. It will set the score of every cow to whatever value the Age-tag currently has. (It would be enough to run this command once right before you want to teleport the babies, maybe in an impulse command block that triggers a chain command block with the /tp command from further down)

/execute as @e[type=cow] store result score @s cowAge run data get entity @s Age 1

After using that command you can teleport all baby cows with this command, it teleports every cow with a cowAge-score of -1, or lower:

/tp @e[type=cow,scores={cowAge=..-1}] <destination>
Big changes for an overall better answer
Source Link
user232393
user232393

Cows (And many other mobs) have an NBT-tag called Age, itwhen the cow is negativborn this tag has a value of -24000 and counting up when they are babies, they growthe cow grows up when it reaches 0. It seems to stay and it stays at 0.

To teleport every cow thatWhen cows breed their age is set to 6000 and it counts down until it reaches 0 again. Cows can not breed unless their age is 0.

There is no way to check if the Age-tag is lower than 0, you can only check for specific values. This means that you can´t teleport all baby cows and no grown up cows, unless you would use 24000 commands, one for every possible age of a command likebaby.

You can however use this command to teleport any cow that was born that tick:

/tp @e[type=minecraft@e[nbt={Age:cow-24000},nbt=type=cow] <destination>

You can use this command to teleport all baby cows and all cows that can´t breed yet:

/tp @e[nbt=!{Age:0}] <target,type=cow] destination><destination>

The target selector specifies any entity that is of the typeAlternatively you can tag all your grown up cows with minecraft/tag @e[nbt={Age:cow0},type=cow] add grownUp, before you breed them and does NOTthen you teleport all cows that don´t have that tag:

/tp @e[type=cow,tag=!grownUp] <destination>

This command would work, but it is too long for a 0command block, so there is no way to execute it in the game:

/execute as @e[type=cow] unless data entity @s {Age:0} unless data entity @s {Age:1} unless data entity @s {Age:2} <continue this for a while> unless data entity @s {Age:5999} unless data entity @s {Age:6000} run tp <destination>

The command length in command blocks is capped at Age-tag32767, this command would have a length of about 180000.

Cows (And many other mobs) have an NBT-tag called Age, it is negativ and counting up when they are babies, they grow up when it reaches 0. It seems to stay at 0.

To teleport every cow that is not grown up you would use a command like this:

/tp @e[type=minecraft:cow,nbt=!{Age:0}] <target destination>

The target selector specifies any entity that is of the type minecraft:cow and does NOT have a 0 in the Age-tag

Cows (And many other mobs) have an NBT-tag called Age, when the cow is born this tag has a value of -24000 and the cow grows up when it reaches 0 and it stays at 0.

When cows breed their age is set to 6000 and it counts down until it reaches 0 again. Cows can not breed unless their age is 0.

There is no way to check if the Age-tag is lower than 0, you can only check for specific values. This means that you can´t teleport all baby cows and no grown up cows, unless you use 24000 commands, one for every possible age of a baby.

You can however use this command to teleport any cow that was born that tick:

/tp @e[nbt={Age:-24000},type=cow] <destination>

You can use this command to teleport all baby cows and all cows that can´t breed yet:

/tp @e[nbt=!{Age:0},type=cow] <destination>

Alternatively you can tag all your grown up cows with /tag @e[nbt={Age:0},type=cow] add grownUp, before you breed them and then you teleport all cows that don´t have that tag:

/tp @e[type=cow,tag=!grownUp] <destination>

This command would work, but it is too long for a command block, so there is no way to execute it in the game:

/execute as @e[type=cow] unless data entity @s {Age:0} unless data entity @s {Age:1} unless data entity @s {Age:2} <continue this for a while> unless data entity @s {Age:5999} unless data entity @s {Age:6000} run tp <destination>

The command length in command blocks is capped at 32767, this command would have a length of about 180000.

Making it more understandable and slightly more general
Source Link
user232393
user232393

Cows (And many other mobs) have a tagan NBT-tag called Age, it is 0negativ and counting up when they are grownbabies, they grow up when it reaches 0. It seems to stay at 0.

To teleport every cow that is not grown up you would use a command like this:

/tp @e[type=minecraft:cow,nbt=!{Age:0}] <target destination>

The target selector specifies any entity that is of the type Ageminecraft:cow tag is negative when they are babies and it counts up, until it reaches 0.does NOT have a 0 in the Age-tag

Cows have a tag called Age, it is 0 when they are grown up.

To teleport every cow that is not grown up you would use a command like this:

/tp @e[type=minecraft:cow,nbt=!{Age:0}] <target destination>

The Age tag is negative when they are babies and it counts up, until it reaches 0.

Cows (And many other mobs) have an NBT-tag called Age, it is negativ and counting up when they are babies, they grow up when it reaches 0. It seems to stay at 0.

To teleport every cow that is not grown up you would use a command like this:

/tp @e[type=minecraft:cow,nbt=!{Age:0}] <target destination>

The target selector specifies any entity that is of the type minecraft:cow and does NOT have a 0 in the Age-tag

Source Link
user232393
user232393
Loading