diff --git a/src/client/java/org/ladysnake/effective/core/index/EffectiveParticles.java b/src/client/java/org/ladysnake/effective/core/index/EffectiveParticles.java index d1a8748..1f7c7bb 100644 --- a/src/client/java/org/ladysnake/effective/core/index/EffectiveParticles.java +++ b/src/client/java/org/ladysnake/effective/core/index/EffectiveParticles.java @@ -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)); @@ -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); } } diff --git a/src/client/java/org/ladysnake/effective/core/particle/MistParticle.java b/src/client/java/org/ladysnake/effective/core/particle/MistParticle.java index 7d813db..4133a46 100644 --- a/src/client/java/org/ladysnake/effective/core/particle/MistParticle.java +++ b/src/client/java/org/ladysnake/effective/core/particle/MistParticle.java @@ -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 { -// 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 { + 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); + } + } +} diff --git a/src/client/java/org/ladysnake/effective/core/world/WaterfallCloudGenerators.java b/src/client/java/org/ladysnake/effective/core/world/WaterfallCloudGenerators.java index ae041de..f07d9aa 100644 --- a/src/client/java/org/ladysnake/effective/core/world/WaterfallCloudGenerators.java +++ b/src/client/java/org/ladysnake/effective/core/world/WaterfallCloudGenerators.java @@ -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; @@ -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) {