Skip to content

Commit

Permalink
make water fog appear directly above the surface
Browse files Browse the repository at this point in the history
  • Loading branch information
PssbleTrngle committed Oct 30, 2024
1 parent 5310b77 commit 1241ad5
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,20 @@ public static void clientTick(TickEvent.ClientTickEvent event) {
var below = level.getBlockState(blockAt.below());

if (below.getFluidState().is(FluidTags.WATER)) {
addFogGroup(level, OParticleTypes.FOG_WATER.get(), at, 3);
addFogGroup(level, OParticleTypes.FOG_WATER.get(), at, 3, 0);
} else if (!below.canBeReplaced()) {
addFogGroup(level, OParticleTypes.FOG.get(), at, 5);
addFogGroup(level, OParticleTypes.FOG.get(), at, 5, 1);
}
}

private static void addFogGroup(Level level, ParticleOptions type, Vec3 at, int amount) {
private static void addFogGroup(Level level, ParticleOptions type, Vec3 at, int amount, double yRange) {
if(level.random.nextInt(amount * 2) != 0) return;

var realAmount = amount - level.random.nextInt(2);

for (int i = 0; i < realAmount; i++) {
level.addParticle(type,
at.x + level.random.nextDouble() * 2 - 1, at.y + 0.5 + level.random.nextDouble(), at.z + level.random.nextDouble() * 2 - 1,
at.x + level.random.nextDouble() * 2 - 1, at.y + 0.5 + level.random.nextDouble() * yRange, at.z + level.random.nextDouble() * 2 - 1,
level.random.nextFloat() + 0.5F, 0.0, 0.0
);
}
Expand Down

0 comments on commit 1241ad5

Please sign in to comment.