From 15f68fdbef0e9c916eb1a0972c3093e5c2ef3223 Mon Sep 17 00:00:00 2001 From: doctor4t Date: Tue, 24 Sep 2024 15:18:34 +0200 Subject: [PATCH] Check for dripstone cave biomes up to 20 blocks above the player for its ambience; this should fix the unreliability of the layout of the biome often not reaching the ground where there are no stalagmites --- .../effective/ambience/EffectiveAmbience.java | 20 ++++++++++++++----- .../effective/core/utils/EffectiveUtils.java | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/client/java/org/ladysnake/effective/ambience/EffectiveAmbience.java b/src/client/java/org/ladysnake/effective/ambience/EffectiveAmbience.java index 950ac6a..2c2a182 100644 --- a/src/client/java/org/ladysnake/effective/ambience/EffectiveAmbience.java +++ b/src/client/java/org/ladysnake/effective/ambience/EffectiveAmbience.java @@ -2,11 +2,7 @@ import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.tag.convention.v1.ConventionalBiomeTags; -import net.minecraft.block.BlockState; -import net.minecraft.registry.tag.BlockTags; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockRenderView; -import net.minecraft.world.World; import net.minecraft.world.biome.BiomeKeys; import org.ladysnake.effective.ambience.sound.AmbientCondition; import org.ladysnake.effective.core.Effective; @@ -66,7 +62,21 @@ public void onInitializeClient() { // water dripping in dripstone caves AMBIENT_CONDITIONS.add(new AmbientCondition(EffectiveAmbienceSounds.WATER_DRIPSTONE_CAVES, AmbientCondition.Type.WATER, - (world, pos, player) -> EffectiveUtils.isInOverworld(world, pos) && world.getBiome(pos).matchesKey(BiomeKeys.DRIPSTONE_CAVES))); + (world, pos, player) -> { + if (EffectiveUtils.isInOverworld(world, pos)) { + if (EffectiveUtils.isInCave(world, pos)) { + BlockPos.Mutable mutable = pos.mutableCopy(); + int startY = mutable.getY(); + for (int y = startY; y <= startY + 20; y += 5) { + mutable.setY(y); + if (world.getBiome(mutable).matchesKey(BiomeKeys.DRIPSTONE_CAVES)) { + return true; + } + } + return false; + } else return world.getBiome(pos).matchesKey(BiomeKeys.DRIPSTONE_CAVES); + } else return false; + })); // water streams in lush caves AMBIENT_CONDITIONS.add(new AmbientCondition(EffectiveAmbienceSounds.WATER_LUSH_CAVES, AmbientCondition.Type.WATER, diff --git a/src/client/java/org/ladysnake/effective/core/utils/EffectiveUtils.java b/src/client/java/org/ladysnake/effective/core/utils/EffectiveUtils.java index 5fb16fa..18abd65 100644 --- a/src/client/java/org/ladysnake/effective/core/utils/EffectiveUtils.java +++ b/src/client/java/org/ladysnake/effective/core/utils/EffectiveUtils.java @@ -73,7 +73,7 @@ public static boolean hasStoneAbove(World world, BlockPos pos) { BlockPos.Mutable mutable = pos.mutableCopy(); int startY = mutable.getY(); for (int y = startY; y <= startY + 100; y++) { - mutable.setY(mutable.getY()+1); + mutable.setY(y); if (world.getBlockState(mutable).isSolidBlock(world, pos) && world.getBlockState(mutable).isIn(BlockTags.PICKAXE_MINEABLE)) { return true; }