Skip to content

Commit

Permalink
Rewrite mist particles
Browse files Browse the repository at this point in the history
  • Loading branch information
doctor4t committed Jan 2, 2025
1 parent 6dd3c13 commit 50bf3a6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.minecraft.client.particle.*;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.particle.SimpleParticleType;
import net.minecraft.util.math.MathHelper;
import org.ladysnake.effective.core.Effective;
import org.ladysnake.effective.core.render.particle.SoftParticleRenderType;

Expand All @@ -19,32 +20,28 @@ public MistParticle(ClientWorld world, double x, double y, double z, double velo
this.setSpriteForAge(spriteProvider);

this.scale = 10f + world.random.nextFloat() * 5f;
this.maxAge = 100;
this.alpha = 0.1f;

// WorldParticleBuilder.create(Effective.MIST)
// .enableForcedSpawn()
// .setSpinData(SpinParticleData.create((world.random.nextFloat() - world.random.nextFloat()) / 20f).build())
// .setScaleData(GenericParticleData.create(10f + world.random.nextFloat() * 5f).build())
// .setTransparencyData(
// GenericParticleData.create(0.001f, 0.1f, 0f)
// .setEasing(Easing.EXPO_OUT, Easing.SINE_OUT)
// .build()
// )
// .setLifetime(300)
// .enableNoClip()
// .setNaturalLighting()
// .setRenderType(LodestoneWorldParticleRenderType.TRANSPARENT.withDepthFade())
// .setColorData(ColorParticleData.create(waterfall.mistColor(), waterfall.mistColor()).build())
// .setMotion(world.getRandom().nextFloat() / 15f * Math.signum(offsetX), world.getRandom().nextGaussian() / 25f, world.getRandom().nextFloat() / 15f * Math.signum(offsetZ))
// .spawn(world, blockPos.getX() + .5f, blockPos.getY() + .5f, blockPos.getZ() + .5f);
this.maxAge = 300;
this.alpha = 0.0001f;

this.velocityMultiplier = 0.999f;
}

@Override
public ParticleTextureSheet getType() {
return SoftParticleRenderType.SOFT_PARTICLE;
}

@Override
public void tick() {
super.tick();

if (this.age <= 20) {
this.alpha = MathHelper.lerp(this.age / 20f, 0.0f, 0.2f);
} else {
this.alpha = MathHelper.lerp((this.age - 20f) / this.maxAge, 0.2f, 0.0f);
}
}

@Environment(EnvType.CLIENT)
public static class Factory implements ParticleFactory<SimpleParticleType> {
private final SpriteProvider spriteProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public static void addWaterfallCloud(World world, Waterfall waterfall) {
double offsetX = world.getRandom().nextGaussian() / 5f;
double offsetZ = world.getRandom().nextGaussian() / 5f;

world.addParticle(EffectiveParticles.MIST, blockPos.getX() + .5f, blockPos.getY() + .5f, blockPos.getZ() + .5f, world.getRandom().nextFloat() / 15f * Math.signum(offsetX), world.getRandom().nextGaussian() / 25f, world.getRandom().nextFloat() / 15f * Math.signum(offsetZ));
world.addParticle(EffectiveParticles.MIST, blockPos.getX() + .5f, blockPos.getY() + .5f, blockPos.getZ() + .5f, EffectiveUtils.getRandomFloatOrNegative(world.random) / 15f, EffectiveUtils.getRandomFloatOrNegative(world.random) / 30f, EffectiveUtils.getRandomFloatOrNegative(world.random) / 15f);
}
}
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 50bf3a6

Please sign in to comment.