No matter the value, and even if the tag does not exist (such as "/summon minecraft:dolphin ~ ~ ~ {TagThatDoesNotExist:1}"), dolphins spawned with a tag will have their "Air" tag set to 0. So they will instantanously start to take damage and try to reach for the surface. So if they can't (or can't do that in time), they will die really quickly.
If you add "Air:4800" to the command ("/summon minecraft:dolphin ~ ~ ~ {TagThatDoesNotExist:1,Air:4800}"), it will fix the problem if the dolphins are in water. But if spawned on the ground, they will still instantanously start to take damage (whereas dolphins spawned on the ground without ANY tag (not even "Air") will need some time before taking damage. Same if they are spawned in water (with a tag) and then teleported on the ground. In which case they might take damage from drowning before being teleported, but that's all).
I've been unable to find (with /data) what tag counts how much time dolphins can stay out of water (it seems to be hidden, but it's probably not supposed to), but it must be set to 0 as well.
Linked issues
Comments 7
I can reproduce this bug. The Air
tag is set to 0 when there are any other tags given in the command.
EDIT: It looks like this happens with every entity. Eg. try summoning a pig underwater with Foo:1
as NBT: it immediately starts taking damage.
What the heck ? This is a duplicate, no problem with that. But this clearly is a bug, and the other bug report is "Works As Intended" ?? And accompanied by a message from a staff member that can be translated as "Don't want to bother solving your bug, use instead that workaround-that-should-not-be-asked-to-use" ???! Omg...
Okay, it may not be an incredibly important bug here, BUT you've done the same with MC-127265 whereas that is a bug that can be dangerous for some people ! (ever heard of epilectic people ?) What kind of nonsense is that ?? Seriously...
Oh, and although I'm sure you don't care, remember about the part where I was talking about the OTHER tag, that it set to 0 as well but that we have no way to know, even with a /data, so we can't even fix ourselves what you refuse to...
This was the first, but clearly is that last version in which I will try to help. I have better to do than fighting for a game I apparently care more about than the ones in charge of it, despite barely playing it anymore...
@Pau Olivares
1) Build underwater something dolphins won't be able to escape from (you can also use a command like "/fill ~ ~ ~ ~ 8 ~ 8 ~ 8 minecraft:glass outline". Just make sure to remove the spaces between " ~ " and the numbers that follow, I have to add them to prevent text formatting. Also, I'm not 100% sure "outline" is what is needed here. I'd say it is, but if it's not, replace it by "hollow")
2) Go inside it
3) /summon dolphin ~ ~ ~
4) It will need some time (4800 ticks) before drowning
5) /summon dolphin ~ ~ ~ {WhateverTagYouWant:9000}
6) It will take drown as soon as summoned
7) /summon dolphin ~ ~ ~ {WhateverTagYouWant:9000,Air:4800}
8) /summon dolphin ~ ~ ~ {WhateverTagYouWant:9000,Air100}
9) The first one will drown after as much time as a normal dolphin, the second one will start drowning after 5 seconds
10) Now spawn them on the ground
11) /summon dolphin ~ ~ ~
12) /summon dolphin ~ ~ ~ {WhateverTagYouWant:9000}
13) /summon dolphin ~ ~ ~ {WhateverTagYouWant:9000,Air:4800}
14) Dolphin from step 11 will need some time before dying (probably 4800 ticks as well), and dolphins from step 12 and 13 will both start dying as soon as they spawn
EDIT : (adding some additionnel steps you can reproduce if you want)
15) To make sure : /gamerule DoMobSpawning false
16) Then : /kill @e[type=dolphin]
17) Go where you built your "dolphin trap / cage" : /summon dolphin ~ ~ ~ {IAmATag:42}
18) Stay near the dolphin before entering that command (and do so quickly) : /data get @e[type=dolphin,limit=1,distance..10]
19) Find the "Air" tag and see it is already set to 0. You can also try to find tag similar to "Air", that would determine for how long a dolphin can stay out of water.
20) Now : /summon dolphin ~ ~ ~
21) Entering that command again : /data get @e[type=dolphin,limit=1,distance..10]
22) You can check again, in case it would now be visible
In MC-78527, it does indeed work as intended, as Sonicwave points out: "It's similar to how when using /summon, skeletons don't spawn with a bow in their hand, and mobs never spawn with armor/weapons unless you specify the weapon." So by nature, summoning an air breathing entity such as a dolphin underwater, the entity will have no air to breath. Just because something may work with a spawn egg, does NOT guarantee it will work the same with summon. The summon command (as far as I know) is designed to 'summon' said entity with, by default, nothing added. TL:DR, Searge is right. It's as intended, and he should know 😉
@Misode
Thank you for pointing out ! I did not think about trying that with other mobs, I should have.
@Andrew
I understand better about that part, indeed (although I find a little annoying to have to specify the skeleton should have a bow), however, I never talked about nor used spawn eggs. The problem here (and it is indeed the same for the other bug report. In any case, if it wasn't, mine should then not be considered as a duplicate) is :
► /summon dolphin ~ ~ ~
→ No tags specified, and the dolphin has air
► /summon dolphin ~ ~ ~ {OgygenPump:1}
→ The dolphin has no air
If the mob had no air either in the first command, okay. It would be stupid in my opinion, but at least it would be consistent. But that's not what happens. And, although that's not exactly the same, I rather see that the same way than invisible armor stands are also invulnerable (not the tag), or that NoAI mobs are invulnerable (still not the tag) and have an effect similar to NoGravity.
(by the way, it still does not change what I said about MC-127265. For which I even gave what seems to me to be the perfect solution)
Sorry for the notification if it bothers someone, I just wish to say that I wanted to try something with the example of the skeleton, that it took me time to think about that at the right moment, but that I finally did it.
The thing is that the example about the skeleton was said in a way that meant "skeleton spawn egg = skeleton with a bow" but "skeleton summoned via command = skeleton withOUT a bow, unless specified". And so after testing, I've seen that actually, as long as you do not add ANY tag within the summon command, the skeleton will have a bow. And so, it actually does work in a consistent manner (just not the one I thought of. And although I find it a little weird, well, this is a choice). And so I take back some things I said.
There still is the problem of the invisible tag though, so I created a bug report for that (sorry again for the notification if it bothers you).
Could you explain the exact steps about how to reproduce it please? 😛