Skip to content

Commit

Permalink
Check for dripstone cave biomes up to 20 blocks above the player for …
Browse files Browse the repository at this point in the history
…its ambience; this should fix the unreliability of the layout of the biome often not reaching the ground where there are no stalagmites
  • Loading branch information
doctor4t committed Sep 24, 2024
1 parent 8e1220a commit 15f68fd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 15f68fd

Please sign in to comment.