2

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.

4

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

  • 1
    Maybe you also want to write somewhere in your answer that picking up items and nametagging sets PersistenceRequired to true. – Fabian Röling Aug 3 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. – bearb001 Aug 3 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? – bearb001 Aug 3 at 12:20
  • 2
    @FabianRöling I figured it out and tested it, I will add it to the answer now – bearb001 Aug 3 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. – bearb001 Aug 3 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.