mojira.dev
MC-190598

"Dimension" NBT tag no longer exists for non-player entities

The NBT tag for Dimension changed in snapshot 20w21a, from a number to namespace ID, {Dimension:-1} to {Dimension:"minecraft:the_nether"} and no longer appears to be detectable by execute commands targeting non-player entities.

Previously this command would work in 1.15: 

execute as @e[type=minecraft:creeper,nbt={Dimension:-1}] at @s run say test

But the new 1.16 command does not work:

execute as @e[type=minecraft:creeper,nbt={Dimension:"minecraft:the_nether"}] at @s run say test

However the same command targeting the player does work in 1.16:

execute as @e[type=minecraft:player,nbt={Dimension:"minecraft:the_nether"}] at @s run say test

An easy way to test this is to make a new world, turn off mob spawning, kill all creepers, then go to the nether and spawn a single creeper and try the commands on it.

If there is a new syntax I am missing and this is not a bug, that would also be highly appreciated to be told, as the documentation is very sparse right now.

Comments 8

Can confirm, the Dimension NBT tag simply no longer exists at all for non-player entities.

Oh wow that sounds like a much worse problem than I initially thought if there isn't an alternative way to checking the dimension of an entity, especially now that datapacks are able to add new dimensions and more people will be wanting to do dimension-specific commands.

Also thanks for cleaning up the post formatting.

You can tag entities per dimension if needed using execute in.

Perhaps I am doing something wrong, but that solution doesn't seem to work.  Maybe this is a separate issue but the "in" dimension execute rule doesn't appear to make entity selection exclusive to that dimension as the purpose from what I understand is to position commands in specific dimensions but it doesn't execute target selectors exclusively in that dimension.

 

I attempted to execute

/execute in minecraft:the_nether run tag @e[type=creeper] add Nether

and also

/execute in minecraft:the_nether as @e[type=creeper] at @s run tag @s add Nether1

And both of these commands simply execute on creepers spawned in both the Nether and Overworld.  Maybe there is a specific format I'm missing for this?

Try adding something like distance or dx/dy/dz to the entity selector.

/execute in minecraft:the_nether as @e[type=minecraft:creeper,distance=0..] run say test

This one works for me. It executes only on creepers in the nether.

Thank you for the solution.  It is somewhat strange to need to do the syntax that way but I suppose I understand why it works and at the very least having something that works is all that matters.

If it works it works, even if it isn't as straightforward, I will keep this in mind.

Why would you remove this though, the new way is much laggier,

Jonathan Isaac Moss

(Unassigned)

Confirmed

Commands

1.16 Release Candidate 1, 1.16

Retrieved