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.

5
  • Is there anything else you have tried before? Along with that, what version of Minecraft are you running?
    – RavenM
    Commented Oct 31, 2015 at 14:23
  • I'm running Minecraft 1.8 Forge
    – fu_______
    Commented Oct 31, 2015 at 14:35
  • Did you make sure they cannot move? They could walk around and kill themselves.
    – Q20
    Commented Oct 31, 2015 at 15:25
  • They've been trapped, so there's no way they could die.
    – fu_______
    Commented Oct 31, 2015 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
    Commented Nov 1, 2015 at 2:25

1 Answer 1

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: https://minecraft.wiki/w/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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .