AlexModGuy / Ice_and_Fire

Minecraft mystical mod
GNU Lesser General Public License v3.0
395 stars 239 forks source link

[Bug]: Structures spawning on top of oceans #5146

Open ffuentesm opened 10 months ago

ffuentesm commented 10 months ago

What happened?

The skeleton of dragons is spawning on top of the water, I assume it should be at the bottom of the ocean, or not be spawning in those areas at all. image

image

Minecraft Version

1.20.1

Ice and Fire version

iceandfire-2.1.13-1.20.1-beta-2

Citadel version

citadel-2.4.9-1.20.1

Relevant log output

No response

Other Information

norfaremc commented 10 months ago

I’m noticing in 1.19.2 that any dungeon spawns on top of the ocean or even on land too. I actually noticed this right after I added ice and fire. One of my staff members said this is actually a bug that’s existed for a few years due to ice and fire, and they were hoping it would be patched out of 1.19.2+. The world does not mess up structure generation in any way unless the ice and fire mod is installed. I don’t really know why? And it seems to be only dungeons.

SiverDX commented 10 months ago

@norfaremc see my comment on the other issue I don't even know what a "dungeon" is in your context

SiverDX commented 10 months ago

@ffuentesm you'll have to post your biome configs and the biomes this happened in Also run /forge tags minecraft:worldgen/biome query <biome> for said biome and post the result

in the default configs graveyard cannot spawn in water-related biomes if that skeleton is from an ice dragon I could imagine this happen in a frozen ocean / frozen river

ffuentesm commented 9 months ago

@SiverDX As you can see on the F3 screen, I am currently on a minecraft:ocean biome. image

When running that command with minecraft:ocean in place of , I get this list: forge:is_overworld forge:is_water iceandfire:has_structure/gorgon_temple iceandfire:has_structure/graveyard iceandfire:has_structure/mausoleum minecraft:has_structure/mineshaft minecraft:has_structure/ocean_ruin_cold minecraft:has_structure/ruined_portal_ocean minecraft:has_structure/shipwreck minecraft:is_ocean minecraft:is_overworld minecraft:plays_underwater_music minecraft:required_ocean_monument_surrounding minecraft:water_on_map_outlines

Apparently the dragon skeleton was on top of the water on a river that passed throughout a savanna biome. image

forge:is_dry forge:is_dry/overworld forge:is_hot forge:is_hot/overworld forge:is_overworld forge:is_rare forge:is_sparse forge:is_sparse/overworld iceandfire:has_structure/gorgon_temple iceandfire:has_structure/graveyard iceandfire:has_structure/mausoleum minecraft:has_structure/mineshaft minecraft:has_structure/ruined_portal_mountain minecraft:is_overworld minecraft:is_savanna minecraft:snow_golem_melts minecraft:spawns_warm_variant_frogs minecraft:stronghold_biased_to
SiverDX commented 9 months ago

and the content of config\iceandfire\graveyard_biomes.json?

ffuentesm commented 9 months ago

As you can see, the "forge:is_water" no longer works, I would recommend using "minecraft:is_ocean" image

In the case of the Skeleton Dragon, it was just bad luck, as the body of water that connects to the river biome, was in a savana chunk near the shore image

SiverDX commented 9 months ago

forge:is_water does work, it's even part of your output (or to say, minecraft:is_ocean wouldn't make a difference here) it contains minecraft:is_ocean and minecraft:is_river

though that biome config looks more like mausoleum

ffuentesm commented 9 months ago

Well, I see the tag, but when running the command, the iceandfire:has_structure/graveyard appears in the minecraft:ocean. So it somehow is passing the filters.

SiverDX commented 9 months ago

has_structure is just is_overworld it's not the actual biomes it can spawn in it's just there to trigger a spawn

when the game wants to spawn a structure it checks against the configured values and determines if it's actually going to spawn or not (this is not how vanilla or other mods do it btw)

SiverDX commented 9 months ago

@TheBv I think this

https://github.com/AlexModGuy/Ice_and_Fire/blob/8d1f70a3cc582ac4133728ecac79379e2f77b505/src/main/java/com/github/alexthe666/iceandfire/world/structure/IafStructure.java#L45-L55

can lead to false positives

This is what the structure usually uses to get the biome:

   private static boolean isValidBiome(Structure.GenerationStub pStub, Structure.GenerationContext pContext) {
      BlockPos blockpos = pStub.position();
      return pContext.validBiome.test(pContext.chunkGenerator.getBiomeSource().getNoiseBiome(QuartPos.fromBlock(blockpos.getX()), QuartPos.fromBlock(blockpos.getY()), QuartPos.fromBlock(blockpos.getZ()), pContext.randomState.sampler()));
   }

I think the current code needs to switch to that (in terms of getting the biome)

Example of the problem:

Checking Gorgon
Biome list:
 [minecraft:beach]  [minecraft:lush_caves]  [minecraft:cold_ocean] 
Biome: [minecraft:cold_ocean]

Used this to get the single biome entry:

pContext.biomeSource().getNoiseBiome(QuartPos.fromBlock(blockPos.getX()), QuartPos.fromBlock(blockPos.getY()), QuartPos.fromBlock(blockPos.getZ()), pContext.randomState().sampler());
SiverDX commented 9 months ago

Alternative: Drop the biome config for structures and let it be handled in the "vanilla" way by defining proper biomes in the biome tag for has_structure