This is somewhat of an extension on this question. It has been answered that the spawner is activated when a player is withing a 17 block radius.

Suppose I'm 16 blocks from the spawner. Timer is set to randInt(200,799) meaning a Random number between 200 and 799. Let's say 444 was picked. I move to 18 blocks from spawn. Will creature still spawn after the 444 counter?

I move back in to the 16 block radius. Was the Timer reset to a new randInt(200,799), so 444 is no longer the time limit?

  • Yes is the answer here, but Yes is often not enough of an answer... – James Jul 3 '13 at 20:31
  • @James Correct, usually the answer desired is, "Yes, because of ...." Do you have reasons for your yes? – John Jul 3 '13 at 20:45
  • 2
    @James, and here I always thought the answer was 42. :) – Batophobia Jul 3 '13 at 21:44
  • One of my favorite Google searches: What is the answer to the ultimate question of life, the universe and ... – musicwithoutpaper Jul 3 '13 at 21:55
  • @DavidStarkey Do you mind adding a few more details to the question? I have a fairly good idea of what you're asking, but that's because I'm a programmer. Some of our non-programmer friends might not fully grasp the question. – MBraedley Jul 3 '13 at 22:34

After initializing the timer, it decreases only if a player is in range. Once the timer reaches zero, the game tries to spawn the configured entities (usually mobs). The timer is paused if all players leave the activation radius of the spawner and is resumed if the spawner is activated again. The timer is reset (re-initialized with a new random number) only after a successful spawning. If spawning conditions are not met (e.g. because the spawner area is well lit), the timer will pause at zero. Then the spawner will try to spawn entities each game tick until it succeeds (e.g. if a critical torch is removed, mobs spawn instantly).

Here is the relevant algorithm (executed each game tick):

if there are players in the activation range then
    if spawnTimeCounter > 0 then
        decrease spawnTimeCounter 
    else if spawnTimeCounter = 0 
        try to spawn entities
        if spawned at least one entity then
            initialize spawnTimeCounter with a new random value
        else if nothing spawned - do nothing
else if no player in the activation range - do nothing

source: MCP 7.5.1 MobSpawnerBaseLogic.java, Minecraft 1.5.2.

  • This is still true in 1.6 I suppose? – Batophobia Jul 4 '13 at 14:52
  • I am pretty sure this is still true in 1.6, considering that there are no mentions of spawner changes in the snapshots and that this particular feature hasn't changed since the very beginning. When I get around to download the latest MCP, I'll be able to check for sure – Kcats Jul 4 '13 at 15:11

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.