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

Fossil structures can't generate in far east and south blocks of a chunk

XMLWordPrintable

    • Confirmed
    • Custom Worlds, World generation
    • Low

      When generating a fossil feature the structure is placed at a random position in the chunk. However this position never includes the far east and south blocks in that chunk (chunk coordinates X=15 or Z=15). This is most obvious when generating structures with size 15x15 as those are always placed at chunk coordinate 0, 0 leaving a one block gap.

      (Note that the placement in a grid is not a bug as the feature explicitly makes sure that the structures do not cross chunk boundaries.)

      How to reproduce:

      1. Create a world with the attached datapack
      2. Teleport to a savanna
      3. Go into spectator mode and fly downwards
      4. You will see the structures as in the image above

      (Note that while this reproduction involves a datapack the bug also affects the vanilla fossils, although its much less obvious because of their smaller size and rarity)

      Code analysis:

      (using the official mappings and some variable renaming)

      The position to place the structure in the chunk is calculated by

      int x = random.nextInt(16 - size.getX());
      int z = random.nextInt(16 - size.getZ());

      However, as the upper bound of random.nextInt is exclusive, the maximum value of x is 16 - size.getX() - 1. The structure would then reach to x + size.get(X) - 1 = 16 - 1 - 1 = 14

        1. 2021-03-11_13.46.44.png
          2021-03-11_13.46.44.png
          2.07 MB
        2. 2021-03-17_22.28.32.png
          2021-03-17_22.28.32.png
          1.93 MB
        3. 2021-11-12_16.05.33.png
          2021-11-12_16.05.33.png
          2.74 MB
        4. 2021-11-12_16.06.50.png
          2021-11-12_16.06.50.png
          1.53 MB
        5. 2021-11-12_18.13.06.png
          2021-11-12_18.13.06.png
          952 kB
        6. FossilBug-1.zip
          2 kB
        7. FossilBug-1-18-pre-1.zip
          5 kB

            Unassigned Unassigned
            CC_fan jacobsjo
            Votes:
            17 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: