Hype Splash Feed

Repeat-worthy fame stories with social momentum.

I'm making an adventure map in Minecraft, and I want to keep zombies from despawning. I've already tried nametags, and they still despawn.

5

1 Answer

If, for whatever reason, nametags don't keep a Zombie from naturally despawning, you can use some NBT magic to do the trick. Each and every Living Entity (aka Mob) has the NBT tag PersistenceRequired of the type boolean. This tag does exactly what you want to achieve.

The MinecraftWiki states the following:

PersistenceRequired: 1 or 0 (true/false) - true if the mob must not despawn naturally.

Source:

Applying that tag to a Zombie can be done in two ways:

1. Summon a new Zombie
/summon Zombie ~ ~ ~ {PersistenceRequired:true}
Of course, you can edit the co-ordinates to whatever fits your needs. The tildes (~) are relative co-ordinates, thus representing the position of the executing player or command block.

2. Edit the entity data of an existing Zombie
/entitydata @e[type=Zombie,r=3,c=1] {PersistenceRequired:true}
For this command to work, the Zombie must be within three blocks in a spherical radius of who- or whatever executes the command (r=3). Of course, you can easily edit that parameter. This command also selects only the nearest Zombie to you or the respective command block (c=1). You can omit the count (c) parameter if you want to do this for every Zombie within the given radius.