3

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.

  • Is there anything else you have tried before? Along with that, what version of Minecraft are you running? – RavenM Oct 31 '15 at 14:23
  • I'm running Minecraft 1.8 Forge – fu_______ Oct 31 '15 at 14:35
  • Did you make sure they cannot move? They could walk around and kill themselves. – QbsidianH20 Oct 31 '15 at 15:25
  • They've been trapped, so there's no way they could die. – fu_______ Oct 31 '15 at 15:29
  • What do you mean "despawn"? If they get killed, it could possibly because they burned in the sun. You can give it headgear (pumpkin, helmet) or create a ceiling to cover the sun. – sensiwoo Nov 1 '15 at 2:25
4

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: http://minecraft.gamepedia.com/Chunk_format

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.

| improve this answer | |

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.