Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-131462

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


    • Confirmed

      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.

            ProfMobius ProfMobius (Thomas Guimbretiere)
            AdmiralFwiffo Admiral Fwiffo
            50 Vote for this issue
            24 Start watching this issue