Mojira Archive
MC-131462

Coordinate math error causes structure not to generate and possibly other issues

The bug

A mistake in coordinate conversion math reduces the likelihood of structures spawning in negative coordinates. This might also cause the /locate command and cartographer maps to direct you to a non-existent structure. It may also be causing other glitches with structures (and other things) along chunk boundaries.

The correct way to find out which structure region a chunk belongs to requires special handling for negative numbers. E.g. for temples with a region size of 32 (pseudocode):

offsetChunk = chunk < 0 ? chunk - 32 + 1 : chunk;
region = offsetChunk / 32;

That puts chunks -32 to -1 in region -1. This is how it's been computed in previous Minecraft versions.

But the new code flipped that +1 to a -1. But then when converting back after selecting the random chunk for structure spawning, it does it the same way it did before.

chunkForStructure = region*32 + random(24);

So, let's say you're chunk -31, 0. You end up in region -2, 0 instead of -1, 0. If the RNG had picked 1, you should have been the lucky chunk and gotten an igloo or something. But instead, it thinks it should put the igloo in chunk -63. But chunk -63 is part of region -3. Any time the RNG ever picks 0 or 1, it cannot generate a structure.

The other changes to structure generation are clearly deliberate, so this appears to be inadvertent.

I believe this was introduced in 18w06a.

Fixed

Admiral Fwiffo

ProfMobius (Thomas Guimbretiere)

2018-06-16, 12:38 PM

2018-08-19, 02:35 PM

2018-07-19, 11:37 AM

50

24

Confirmed

Minecraft 1.13-pre2, Minecraft 1.13-pre10, Minecraft 1.13

Minecraft 1.13-pre4, Minecraft 18w30a