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

Adding ocean monuments to non-ocean/non-river biomes by datapack will not spawn the monument and causes the game to freeze upon '/locate monument'

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.16.4, 1.16.5, 21w10a
    • None
    • Confirmed
    • Custom Worlds
    • Important
    • Platform

      The bug

      If using the new worldgen datapack system and you add the ocean monument to a biome that does not have the ocean or river category, the structure will not spawn. Worse, if you make a dimension of just that biome and attempt to do /locate monument, the game will hang forever. Chunks will not load. Mobs freeze. Nothing in the logs. 

      Attached is a datapack that demonstrates this issue. Do /execute in testdim:testdim run tp ~ ~ ~ and then do /locate monument and your game will be stuck and forces you to use task manager to kill the game.

      The reason for this is because in the code for the monument, the check it is doing is hardcoded to check for ocean and river category biomes which is a dangerous assumption as shown here with the datapack. In OceanMonumentFeature class, the isFeatureChunk method has this check biome.getBiomeCategory() == Biome.Category.OCEAN || biome.getBiomeCategory() == Biome.Category.RIVER. That means when it is in a dimension full of biomes that are not ocean or river category, the game will check every chunk forever in an attempt to try and find a spot to spawn the monument.

      Instead, a better and far more safer solution would be to add this one extra check biome.getGenerationSettings().canGenerateStructure(this) || biome.getBiomeCategory() == Biome.Category.OCEAN || biome.getBiomeCategory() == Biome.Category.RIVER`

      By checking if the biome has the structure, now ocean monuments can spawn in biomes that are not ocean or river if done so by datapacks without causing the game to hang forever. In fact, woodland mansions has a very similar check except they do biome.getGenerationSettings().canGenerateStructure(this) which is why that structure won't cause issues when added to other biomes by datapack.

            Unassigned Unassigned
            TelepathicGrunt TelepathicGrunt
            Votes:
            9 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              CHK: