Skip to content

Commit

Permalink
Readd mist
Browse files Browse the repository at this point in the history
  • Loading branch information
doctor4t committed Jan 1, 2025
1 parent 8967248 commit 6dd3c13
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public interface EffectiveParticles {
SimpleParticleType END_BUBBLE = create("end_bubble", FabricParticleTypes.simple(true));
SimpleParticleType CASCADE = create("cascade", FabricParticleTypes.simple(true));
SimpleParticleType GLOW_CASCADE = create("glow_cascade", FabricParticleTypes.simple(true));
SimpleParticleType MIST = create("mist", FabricParticleTypes.simple(true));

static void initialize() {
PARTICLES.keySet().forEach(particle -> Registry.register(Registries.PARTICLE_TYPE, PARTICLES.get(particle), particle));
Expand All @@ -51,5 +52,6 @@ private static void registerFactories() {
ParticleFactoryRegistry.getInstance().register(END_BUBBLE, EndBubbleParticle.Factory::new);
ParticleFactoryRegistry.getInstance().register(CASCADE, CascadeParticle.Factory::new);
ParticleFactoryRegistry.getInstance().register(GLOW_CASCADE, GlowCascadeParticle.Factory::new);
ParticleFactoryRegistry.getInstance().register(MIST, MistParticle.Factory::new);
}
}
Original file line number Diff line number Diff line change
@@ -1,60 +1,61 @@
//package org.ladysnake.effective.core.particle;
//
//import net.fabricmc.api.EnvType;
//import net.fabricmc.api.Environment;
//import net.minecraft.client.particle.*;
//import net.minecraft.client.world.ClientWorld;
//import net.minecraft.particle.SimpleParticleType;
//import org.ladysnake.effective.core.Effective;
//
//public class MistParticle extends SpriteBillboardParticle {
// public MistParticle(ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ, SpriteProvider spriteProvider) {
// super(world, x, y, z, velocityX, velocityY, velocityZ);
//
// this.velocityX = velocityX;
// this.velocityY = velocityY;
// this.velocityZ = velocityZ;
//
// this.setSpriteForAge(spriteProvider);
//
// this.scale = 10f + world.random.nextFloat() * 5f;
// this.maxAge = 0;
// this.alpha = 0.01f;
//
//// 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);
// }
//
// @Override
// public ParticleTextureSheet getType() {
// return ParticleTextureSheet.PARTICLE_SHEET_TRANSLUCENT;
// }
//
// @Environment(EnvType.CLIENT)
// public static class Factory implements ParticleFactory<SimpleParticleType> {
// private final SpriteProvider spriteProvider;
//
// public Factory(SpriteProvider spriteProvider) {
// this.spriteProvider = spriteProvider;
// }
//
// @Override
// public Particle createParticle(SimpleParticleType parameters, ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) {
// return new MistParticle(world, x, y, z, velocityX, velocityY, velocityZ, this.spriteProvider);
// }
// }
//}
package org.ladysnake.effective.core.particle;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.particle.*;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.particle.SimpleParticleType;
import org.ladysnake.effective.core.Effective;
import org.ladysnake.effective.core.render.particle.SoftParticleRenderType;

public class MistParticle extends SpriteBillboardParticle {
public MistParticle(ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ, SpriteProvider spriteProvider) {
super(world, x, y, z, velocityX, velocityY, velocityZ);

this.velocityX = velocityX;
this.velocityY = velocityY;
this.velocityZ = velocityZ;

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);
}

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

@Environment(EnvType.CLIENT)
public static class Factory implements ParticleFactory<SimpleParticleType> {
private final SpriteProvider spriteProvider;

public Factory(SpriteProvider spriteProvider) {
this.spriteProvider = spriteProvider;
}

@Override
public Particle createParticle(SimpleParticleType parameters, ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) {
return new MistParticle(world, x, y, z, velocityX, velocityY, velocityZ, this.spriteProvider);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ public static void addWaterfallCloud(World world, Waterfall waterfall) {
world.addParticle(EffectiveUtils.isGlowingWater(world, waterfall.blockPos()) ? EffectiveParticles.GLOW_CASCADE : EffectiveParticles.CASCADE, blockPos.getX() + .5 + offsetX, blockPos.getY() + world.getRandom().nextFloat(), blockPos.getZ() + .5 + offsetZ, (world.getRandom().nextFloat() * waterfall.strength()) / 10f * Math.signum(offsetX), (world.getRandom().nextFloat() * waterfall.strength()) / 10f, (world.getRandom().nextFloat() * waterfall.strength()) / 10f * Math.signum(offsetZ));
}

/*
if (EffectiveConfig.cascadeMistDensity > 0f && waterfall.strength() >= 1.6f) {
if ((world.random.nextFloat() * 100f) <= EffectiveConfig.cascadeMistDensity) {
double offsetX = world.getRandom().nextGaussian() / 5f;
Expand All @@ -167,7 +166,6 @@ public static void addWaterfallCloud(World world, Waterfall waterfall) {
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));
}
}
*/
}

public static void scheduleParticleTick(Waterfall waterfall, int ticks) {
Expand Down

0 comments on commit 6dd3c13

Please sign in to comment.