diff --git a/src/main/java/com/sammy/malum/common/block/curiosities/ritual_plinth/RitualPlinthBlockEntity.java b/src/main/java/com/sammy/malum/common/block/curiosities/ritual_plinth/RitualPlinthBlockEntity.java index d2d65bc56..067993729 100644 --- a/src/main/java/com/sammy/malum/common/block/curiosities/ritual_plinth/RitualPlinthBlockEntity.java +++ b/src/main/java/com/sammy/malum/common/block/curiosities/ritual_plinth/RitualPlinthBlockEntity.java @@ -69,15 +69,16 @@ public InteractionResult onUse(Player player, InteractionHand hand) { @Override public void tick() { super.tick(); + if (level.isClientSide) { + RitualPlinthParticleEffects.passiveRitualPlinthParticles(this); + } } -// public Vec3 getItemPos() { -// final BlockPos blockPos = getBlockPos(); -// final Vec3 offset = getCentralItemOffset(); -// return new Vec3(blockPos.getX() + offset.x, blockPos.getY() + offset.y, blockPos.getZ() + offset.z); -// } -// -// public Vec3 getCentralItemOffset() { -// return ALTAR_ITEM_OFFSET; -// } + public Vec3 getParticlePositionPosition(Direction direction) { + final BlockPos blockPos = getBlockPos(); + float x = blockPos.getX() + 0.5f + direction.getStepX()*0.7f; + float y = blockPos.getY() + 0.85f; + float z = blockPos.getZ() + 0.5f + direction.getStepZ()*0.7f; + return new Vec3(x, y, z); + } } diff --git a/src/main/java/com/sammy/malum/visual_effects/RitualPlinthParticleEffects.java b/src/main/java/com/sammy/malum/visual_effects/RitualPlinthParticleEffects.java new file mode 100644 index 000000000..d55aa1de8 --- /dev/null +++ b/src/main/java/com/sammy/malum/visual_effects/RitualPlinthParticleEffects.java @@ -0,0 +1,48 @@ +package com.sammy.malum.visual_effects; + +import com.sammy.malum.common.block.curiosities.ritual_plinth.RitualPlinthBlockEntity; +import com.sammy.malum.common.block.curiosities.spirit_altar.SpiritAltarBlockEntity; +import com.sammy.malum.core.systems.spirit.MalumSpiritType; +import com.sammy.malum.registry.common.SpiritTypeRegistry; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; +import team.lodestar.lodestone.helpers.RandomHelper; +import team.lodestar.lodestone.systems.particle.builder.SparkParticleBuilder; + +import static com.sammy.malum.visual_effects.SpiritLightSpecs.spiritLightSpecs; + +public class RitualPlinthParticleEffects { + public static void passiveRitualPlinthParticles(RitualPlinthBlockEntity plinth) { + Level level = plinth.getLevel(); + MalumSpiritType spiritType = SpiritTypeRegistry.INFERNAL_SPIRIT; + RandomSource random = level.random; + for (Direction direction : Direction.values()) { + if (direction.getAxis().equals(Direction.Axis.Y)) { + continue; + } + Vec3 particlePosition = plinth.getParticlePositionPosition(direction); + Vec3 particleVelocity = new Vec3(0.03f * direction.getStepX(), 0, 0.03f * direction.getStepZ()); + if (level.getGameTime() % 3L == 0) { + Vec3 randomizedVelocity = particleVelocity.scale(RandomHelper.randomBetween(random, 0.8f, 1f)); + var lightSpecs = spiritLightSpecs(level, particlePosition, spiritType); + lightSpecs.getBuilder().setMotion(randomizedVelocity); + lightSpecs.getBloomBuilder().setMotion(randomizedVelocity); + lightSpecs.spawnParticles(); + } + if (level.getGameTime() % 4L == 0) { + Vec3 randomizedVelocity = particleVelocity.scale(RandomHelper.randomBetween(random, 0.8f, 1f)); + Vec3 sparkPos = particlePosition.add(0.05f - random.nextFloat() * 0.1f, 0.05f - random.nextFloat() * 0.1f, 0.05f - random.nextFloat() * 0.1f); + var sparkParticles = SparkParticleEffects.spiritMotionSparks(level, sparkPos, spiritType); + sparkParticles.getBuilder().setMotion(randomizedVelocity) + .modifyData(SparkParticleBuilder::getScaleData, d -> d.multiplyValue(1.5f)) + .modifyData(SparkParticleBuilder::getLengthData, d -> d.multiplyValue(2f).multiplyCoefficient(0.75f)) + .modifyColorData(c -> c.multiplyCoefficient(0.8f)); + sparkParticles.getBloomBuilder().setMotion(randomizedVelocity); + sparkParticles.spawnParticlesRaw(); + } + + } + } +}