mojira.dev
MC-4855

Mob spawners miss a row on X and Z axis for the spawn range

I manipulated NBT data a bit to spawn anvils with mob spawners. Problem is they always miss one row on X and Z axis.

As english isn't my native language I made a video showing the issue. It's to large to upload as attachment, so here's a link: https://vimeo.com/55709238

Also I try to explain: Let's say the spawner is at x 6 and z 6. spawn range is 5. The expected output is to add 5 to all sides, so spawn from 0 to 11 on x and z (5 + 1 (the mob spawner) + 5). The given result is 5 + 1 + 4, so from 0 to 10.

BTW: This happens with all entities, anvils are just good to show it. This note is important as it says that this happens with vanilla gameplay, too.

Comments 5

Possible fix
(Using MCP naming)

TileEntityMobSpawner.updateEntity()

...
    if (var13 != null) {
        var5 = (double) this.xCoord + (this.worldObj.rand.nextDouble() - this.worldObj.rand.nextDouble()) * (double) this.spawnRange;
        var5 += 0.5; // FIX, feel free to combine into the previous line
        double var7 = (double) (this.yCoord + this.worldObj.rand.nextInt(3) - 1);
        double var9 = (double) this.zCoord + (this.worldObj.rand.nextDouble() - this.worldObj.rand.nextDouble()) * (double) this.spawnRange;
        var9 += 0.5; // FIX, feel free to combine into the previous line
        ...

I did not test these changes, but it looks quite obvious.

Well hello there bug. You've been around a while.

This is still in the game as of the latest Minecraft version. SpawnRange doubles.
SpawnRange:1 checks 2 blocks outward from the spawner.
SpawnRange:2 checks 4 blocks outward from the spawner.
SpawnRange:3 checks 6 blocks outward from the spawner, etc.

Confirmed in 13w21b.

Is this still a concern in the latest Minecraft version 14w05b? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

ya it's still around

Thomas Rohloff

migrated

Confirmed

mobSpawner

Minecraft 1.4.5, Minecraft 1.5.1, Minecraft 1.5.2, Snapshot 13w19a, Snapshot 13w21a, Snapshot 13w21b, Minecraft 1.7.9, Minecraft 14w20b, Minecraft 14w21a, Minecraft 14w21b

Minecraft 14w26c

Retrieved