Arqade is a question and answer site for passionate videogamers on all platforms. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I understand monsters only spawn in a 9 x 9 grid of chunks centered on the player, and I assume they stay around while they remain within that distance of you. But do they despawn as soon as you move away from them? Or do they remain? If so what (if anything) causes them to despawn? Are the rules any different for passive mobs?

Will running far away from an area and then coming right back clear it of monsters?

share|improve this question

This question has an open bounty worth +50 reputation from MrLemon ending in 6 days.

The current answer(s) are out-of-date and require revision given recent changes.

    
Interesting! If they don't despawn this is useful for mob spawners, although I use creative mode these days... – Tom Wijsman Oct 2 '11 at 1:27
    
I believe you are referring to passive mobs. They respawn very slowly, but there are many more. – Domocus Oct 2 '11 at 1:39
    
Farm animals actually respawn in 1.8? I thought I drove them to extinction - at least, I have yet to see any new ones... – Cyclops Oct 2 '11 at 20:19
    
I see no discussion of vertical. Is vertical distance irrelevant for spawning? – John Jan 13 '12 at 15:12
up vote 15 down vote accepted

Most important rule: when a chunk is unloaded, so are the mobs (and all other items) on it, although passive mobs won't be removed.

There is also a limit on the number of mobs that can be loaded at one time: 200 hostile and 15 neutral mobs (I don't know if there's a limit on passive mobs). Also, hostile mobs are removed if they leave the 9x9 chunks that they're allowed to spawn in.

Running away will usually allow you to stay out of the reach of hostile mobs, since a chunk needs to be loaded a certain amount of time before mobs will start to spawn, but the chunks immediately behind you could have the max allowable mobs, making it dangerous at best to turn around.

Take a look at the wiki for more information.

share|improve this answer
    
"so are the mobs" except for squid. – Madame Elyse May 2 '11 at 22:03
    
Yes, squid do have special rules, but they still despawn when the chunk they're in is unloaded. – MBraedley May 3 '11 at 2:01
    
As of 1.8 passive mobs no longer despawn. – John the Green Sep 22 '11 at 20:42
    
@John: Even when a chunk is unloaded? – MBraedley Sep 23 '11 at 10:38
    
Correct. Notch decided to try to make passive mobs more permanent so he removed the code that despawned them. – John the Green Sep 23 '11 at 15:35

From the EntityAnimal class in EntityAnimal.java:

protected boolean canDespawn()
{
    return false;
}

This should apply to all passive mobs. (I checked, they all extend the EntityAnimal class.)

Wolves however are interesting:

protected boolean canDespawn()
{
    return !isWolfTamed();
}

So this means that tamed wolves do not despawn, while wild wolves do despawn.

It seems that slimes and squid will also despawn. Both classes contain this method:

protected void updateEntityActionState()
<snipped>
    despawnEntity();
<snipped>

I didn't see any other references to despawning.

share|improve this answer
    
Where did you obtain the source code of Minecraft? – Anderson Green Nov 1 '12 at 1:02
    
@AndersonGreen I use the Minecraft Coder Pack – John the Green Nov 1 '12 at 16:46

As of Minecraft 1.8, these are the two main despawning rules:

  • If a mob has not been within 32 blocks1 of a player for more than 30 seconds, it has a 1 in 800 chance every tick of despawning (about 1 in 40 every second)
  • If there are no players within a 128 block radius2 of a mob, it will instantly despawn

Exceptions:

  • Mobs with nametags will never despawn, except...
  • Mobs which have picked up items (i.e. were not spawned with that item) will never despawn, except...
  • When the gamemode is set to peaceful, all hostile mobs will despawn (including those with nametags, or those who have picked up items)
  • Passive mobs will never despawn (except chickens originally spawned as chicken jockeys, which will follow zombie despawning rules)

For those who like diagrams, this image will help: (From the Minecraft Wiki)

Diagram of which the information is outlined in dotpoints

Footnotes:

1 Not sure whether this is a sphere or a cylinder It is confirmed to be an Euclidean sphere (like the the instant despawn zone). Testing apparatus:

The zombie despawned after about 2 mins when I stood more than 32 blocks below it

2 An Euclidean sphere with a radius of 128 blocks

More Notes:

  • If there are more mobs than allowed by their mob cap, no special despawning rules are followed. Mob spawning is simply suspended until they despawn naturally. Source (looking for a better citation)
share|improve this answer
    
Small nitpick, the chances of a mob despawning in a given second are slightly worse than 1 in 40, because statistics are messed up that way. – MBraedley 15 hours ago
    
@MBraedley Edited. – angussidney 3 hours ago

EDIT: The forum post is apparently gone in one of curse's migrations of the minecraft forums. Until I can find a good suitable replacement the Wiki page is the best I can come up with which can be found here.

Information most notably claims there is a 60 block radius around the player that hostile mobs can spawn in, but there is a 24 block buffer zone centered around the player that hostile mobs will not spawn within..

A quick answer to some of your questions from my own observations:

  1. Yes, they will despawn if you move far enough away.

  2. I am not sure of the exact rules, but I would bet the 60 block range is one of them. I have had things fairly close to me (Within the 24 block range) just despawn at times for apparently no reason (most notably with creepers believe it or not).

  3. They are a bit different in the areas they can spawn within to begin with (grass and well lit) as well as the range and count of them. It also appears that they follow the same general guidelines for despawning, based on their spawn rules.. The forum post mentioned above can get you the details there (their distances and the like).

  4. Yes, if you run far enough, what was there will despawn. However, it is just as likely that the area will respawn, if it is night, as you are running towards it because of the 'donut' spawn area I mentioned above (closer than 60 blocks, farther than 24 blocks).

Anywho, enjoy the link, helped me out quite a bit!

share|improve this answer
    
It's a 144 x 144 block area centered on the player. That's more like a 144 block diameter, not a 144 block radius. – Matt May 3 '11 at 11:47
    
@Matt you are correct! I went back and re-read Item 3, and while the wont spawn radius is 24m, the will spawn radius appears to be 60m around you (excluding that 24m radius). Answer Updated :) – James May 3 '11 at 16:05
    
@James the forum link appears to be dead? – John Jan 13 '12 at 15:11

protected by fredley Apr 22 '13 at 13:49

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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