From 859028af6a1e27bf33a7597efa52db612a3a92d6 Mon Sep 17 00:00:00 2001 From: SammySemicolon <69329424+SammySemicolon@users.noreply.github.com> Date: Sun, 29 Oct 2023 16:22:05 +0100 Subject: [PATCH] Weeping well radiance test --- gradle.properties | 2 +- .../WeepingWellParticleEffects.java | 65 ++++++++++++++----- 2 files changed, 51 insertions(+), 16 deletions(-) diff --git a/gradle.properties b/gradle.properties index d6e3c87ac..4e550858a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.daemon=false # Dependency Version minecraftVersion=1.18.2 forgeVersion=40.2.0 -lodestoneVersion=1.4.2.496 +lodestoneVersion=1.4.2.501 forgegradleVersion=5.1.53 mixingradleVersion=0.7-SNAPSHOT librarianVersion=1.+ diff --git a/src/main/java/com/sammy/malum/visual_effects/WeepingWellParticleEffects.java b/src/main/java/com/sammy/malum/visual_effects/WeepingWellParticleEffects.java index 8ff0fbe34..eacd23fe5 100644 --- a/src/main/java/com/sammy/malum/visual_effects/WeepingWellParticleEffects.java +++ b/src/main/java/com/sammy/malum/visual_effects/WeepingWellParticleEffects.java @@ -1,6 +1,7 @@ package com.sammy.malum.visual_effects; import com.sammy.malum.common.block.curiosities.weeping_well.*; +import com.sammy.malum.common.entity.nitrate.*; import com.sammy.malum.registry.client.*; import net.minecraft.core.*; import net.minecraft.world.level.*; @@ -19,12 +20,19 @@ import java.awt.*; import java.util.*; +import java.util.List; import java.util.function.*; +import static com.sammy.malum.common.entity.nitrate.VividNitrateEntity.COLOR_FUNCTION; import static com.sammy.malum.visual_effects.SpiritLightSpecs.spiritLightSpecs; public class WeepingWellParticleEffects { + public static final List RADIANT_COLORS = List.of( + new Color(249, 206, 77), + new Color(145, 42, 247), + new Color(48, 208, 242)); + private static final VoxelShape WELL_SHAPE = Block.box(-16.0D, 11.0D, -16.0D, 32.0D, 13.0D, 32.0D); private static final GenericParticleData SMOKE_TRANSPARENCY = GenericParticleData.create(0, 0.2f, 0f).setEasing(Easing.SINE_IN, Easing.SINE_OUT).build(); @@ -73,36 +81,63 @@ public static void passiveWeepingWellParticles(VoidConduitBlockEntity voidCondui } } - public static void radiantWeepingWellParticles(VoidConduitBlockEntity voidConduit) { Level level = voidConduit.getLevel(); - final BlockPos blockPos = voidConduit.getBlockPos(); Random rand = level.random; - int lifetime = RandomHelper.randomBetween(rand, 40, 80); - float xMotion = 0; - float yMotion = RandomHelper.randomBetween(rand, -0.05f, 0.05f); - float zMotion = 0; - Vec3 motion = new Vec3(xMotion, yMotion, zMotion); - DirectionalParticleBuilder.create(ParticleRegistry.SQUARE) - .setDirection(motion.normalize().scale(Math.PI*2)) - .setLifetime(lifetime) - .setMotion(motion) - .setRenderType(LodestoneWorldParticleRenderType.LUMITRANSPARENT) - .spawn(level, blockPos.getX(), blockPos.getY()+4, blockPos.getZ()); + Color color = RADIANT_COLORS.get(((int) level.getGameTime() % 18) / 6); + final BlockPos blockPos = voidConduit.getBlockPos(); + final ColorParticleData colorData = ColorParticleData.create(color, color.darker()).setCoefficient(0.5f).build(); + + if (level.getGameTime() % 6L == 0) { + final Consumer slowDown = p -> p.setParticleMotion(p.getParticleSpeed().scale(0.95f)); + int lifetime = RandomHelper.randomBetween(rand, 100, 120); + float yMotion = RandomHelper.randomBetween(rand, 0.01f, 0.02f); + Vec3 motion = new Vec3(0f, yMotion, 0f); + DirectionalParticleBuilder.create(ParticleRegistry.SQUARE) + .setTransparencyData(GenericParticleData.create(0.2f, 0.5f, 0f).setEasing(Easing.CUBIC_OUT, Easing.EXPO_IN).build()) + .setScaleData(GenericParticleData.create(0.1f, RandomHelper.randomBetween(rand, 1.85f, 2f)).setEasing(Easing.SINE_OUT).setCoefficient(RandomHelper.randomBetween(rand, 1f, 1.5f)).build()) + .setColorData(colorData) + .setLifetime(lifetime) + .setMotion(motion) + .setDirection(motion.normalize()) + .enableNoClip() + .addActor(slowDown) + .spawn(level, blockPos.getX() + 0.5f, blockPos.getY() + 0.75f, blockPos.getZ() + 0.5f); + } + + final float acceleration = RandomHelper.randomBetween(rand, 0.002f, 0.02f); + final long gameTime = level.getGameTime(); + final Consumer behavior = p -> { + if (level.getGameTime() < gameTime + 5) { + p.setParticleMotion(p.getParticleSpeed().add(0, acceleration, 0)); + } + }; + if (level.getGameTime() % 2 == 0) { + int rotation = (int) (level.getGameTime() / 2f % 16); + Vec3 offsetPosition = DataHelper.rotatingRadialOffset(new Vec3(blockPos.getX() + 0.5f, blockPos.getY() + 0.75f, blockPos.getZ() + 0.5f), 1.1f, rotation, 16, voidConduit.getLevel().getGameTime(), 640); + var lightSpecs = weepingWellSpecs(level, offsetPosition, colorData, LodestoneWorldParticleRenderType.ADDITIVE); + lightSpecs.getBuilder().addActor(behavior); + lightSpecs.getBloomBuilder().addActor(behavior); + lightSpecs.spawnParticles(); + } } public static ParticleEffectSpawner weepingWellSpecs(Level level, Vec3 pos) { Random rand = level.random; Color color = getWeepingWellSmokeColor(rand); ColorParticleData colorData = ColorParticleData.create(color, color.darker()).setCoefficient(0.5f).build(); + return weepingWellSpecs(level, pos, colorData, LodestoneWorldParticleRenderType.LUMITRANSPARENT); + } + public static ParticleEffectSpawner weepingWellSpecs(Level level, Vec3 pos, ColorParticleData colorData, LodestoneWorldParticleRenderType renderType) { + Random rand = level.random; var lightSpecs = spiritLightSpecs(level, pos, colorData, colorData, ParticleRegistry.LIGHT_SPEC_SMALL); lightSpecs.getBuilder().act(b -> b - .setRenderType(LodestoneWorldParticleRenderType.LUMITRANSPARENT) + .setRenderType(renderType) .multiplyLifetime(6f) .modifyData(b::getTransparencyData, d -> d.multiplyValue(RandomHelper.randomBetween(rand, 0.75f, 1f))) .modifyData(b::getScaleData, d -> d.multiplyValue(RandomHelper.randomBetween(rand, 1.5f, 3.5f)))); lightSpecs.getBloomBuilder().act(b -> b - .setRenderType(LodestoneWorldParticleRenderType.LUMITRANSPARENT) + .setRenderType(renderType) .multiplyLifetime(6f) .setTransparencyData(GenericParticleData.create(0f, 0.75f, 0.25f).build()) .setDiscardFunction(SimpleParticleOptions.ParticleDiscardFunctionType.ENDING_CURVE_INVISIBLE)