-
Bug
-
Resolution: Fixed
-
21w10a, 21w11a
-
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:
- Create a world with the attached datapack
- Teleport to a savanna
- Go into spectator mode and fly downwards
- 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