Can scoreboard tags affect entity despawning? I checked the wiki, but there is no mention of it. Logically, it seems like the answer would be no, because they just classify/identify entities, but name-tagging an entity makes it despawn-proof, so maybe tags do too? Just wanting to be sure.
1 Answer
The only NBT-tag that affects mob despawning is the PersistenceRequired
-tag, a custom name does NOT change this behaviour.
This command summons a renamed zombie that will despawn:
/summon minecraft:zombie ~ ~ ~ {CustomName:'{"text":"zombie"}'}
This command summons a renamed zombie that will not despawn:
/summon minecraft:zombie ~ ~ ~ {CustomName:'{"text":"zombie"}',PersistenceRequired:1b}
Changing the name of a zombie with a name tag will change both the name and set the PersistenceRequired
-tag to 1.
If a zombie picks up an item, then the PersistenceRequired
-tag will be set to 1.
Credits go to Fabian Röling for mentioning this in the comments
In conclusion, using this command will not make the nearest zombie despawn-proof:
/tag @e[type=minecraft:zombie,sort=nearest,limit=1] add zombie
Note: I only tested wether or not a zombie despawns in those cases, it may be possible that they take longer to despawn, or despawn quicker, or that they are affected in some other way.
Note 2: I only tested this with zombies, but it should apply to any entity
-
1Maybe you also want to write somewhere in your answer that picking up items and nametagging sets
PersistenceRequired
totrue
. Commented Aug 3, 2019 at 12:07 -
@FabianRöling I did mention the nametagging ("Changing the name of an entity with a name tag will change both the name and set the PersistenceRequired-tag to 1.") and I haven't tested about picking up items, I will test that and add it to the answer.– user232393Commented Aug 3, 2019 at 12:17
-
@FabianRöling Items don't have the
PersistenceRequired
-tag, neither before picking them up, nor after dropping them. Can you please elaborate on what you mean?– user232393Commented Aug 3, 2019 at 12:20 -
2@FabianRöling I figured it out and tested it, I will add it to the answer now– user232393Commented Aug 3, 2019 at 12:27
-
1@Nik3141 You can set the
PersistenceRequired
-tag to 1 to make sure they won't despawn, I'm assuming that you know how to do that, so I leave it at that.– user232393Commented Aug 3, 2019 at 17:09