Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks done
ffuentesm opened this issue Feb 3, 2024 · 11 comments
Open
2 tasks done

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

ffuentesm opened this issue Feb 3, 2024 · 11 comments

Comments

@ffuentesm
Copy link

ffuentesm commented Feb 3, 2024

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

  • I am using other mods besides Ice and Fire
  • I have attached a log file from the session that I have experienced this issue
@ffuentesm ffuentesm added the bug label Feb 3, 2024
@github-actions github-actions bot added the 1.20 label Feb 3, 2024
@ffuentesm ffuentesm changed the title [Bug]: Dragon skeletons spawning on top of oceans [Bug]: Structures spawning on top of oceans Feb 4, 2024
@norfaremc
Copy link

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
Copy link
Contributor

SiverDX commented Feb 7, 2024

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

@SiverDX
Copy link
Contributor

SiverDX commented Feb 7, 2024

@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
Copy link
Author

@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

minecraft:windswept_savana
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
Copy link
Contributor

SiverDX commented Feb 7, 2024

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

@ffuentesm
Copy link
Author

ffuentesm commented Feb 7, 2024

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
Copy link
Contributor

SiverDX commented Feb 7, 2024

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
Copy link
Author

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
Copy link
Contributor

SiverDX commented Feb 7, 2024

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
Copy link
Contributor

SiverDX commented Feb 7, 2024

@TheBv I think this

protected boolean isBiomeValid(GenerationContext pContext, Pair<String, SpawnBiomeData> validBiomes, BlockPos blockPos) {
boolean validBiome = false;
Set<Holder<Biome>> biomes = pContext.chunkGenerator().getBiomeSource().getBiomesWithin(blockPos.getX(), blockPos.getY(), blockPos.getZ(), this.maxDistanceFromCenter, pContext.randomState().sampler());
for (Holder<Biome> biome : biomes) {
if (BiomeConfig.test(validBiomes, biome)) {
validBiome = true;
break;
}
}
return validBiome;
}

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
Copy link
Contributor

SiverDX commented Feb 7, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants