diff --git a/src/main/java/com/sammy/malum/client/renderer/block/SpiritCatalyzerRenderer.java b/src/main/java/com/sammy/malum/client/renderer/block/SpiritCatalyzerRenderer.java index ad9897212..a5974cee8 100644 --- a/src/main/java/com/sammy/malum/client/renderer/block/SpiritCatalyzerRenderer.java +++ b/src/main/java/com/sammy/malum/client/renderer/block/SpiritCatalyzerRenderer.java @@ -47,7 +47,7 @@ public void render(SpiritCatalyzerCoreBlockEntity blockEntityIn, float partialTi itemRenderer.renderStatic(stack, ItemDisplayContext.FIXED, combinedLightIn, NO_OVERLAY, poseStack, bufferIn, level, 0); poseStack.popPose(); } - if (blockEntityIn.getTarget() != null) { + if (blockEntityIn.getTarget() != null && blockEntityIn.intensity != null) { poseStack.pushPose(); final BlockPos blockPos = blockEntityIn.getBlockPos(); poseStack.translate(-blockPos.getX(), -blockPos.getY(), -blockPos.getZ()); @@ -66,7 +66,6 @@ public void renderBeam(SpiritCatalyzerCoreBlockEntity catalyzer, PoseStack poseS Vec3 startPos = catalyzer.getItemOffset().add(catalyzerPos.getX(), catalyzerPos.getY(), catalyzerPos.getZ()); Vec3 targetPos = catalyzer.getTarget().getAccelerationPoint(); Vec3 difference = targetPos.subtract(startPos); - MalumMod.LOGGER.info(intensity); float distance = 0.35f + Easing.SINE_OUT.ease(intensity / 60f, 0, 0.35f, 1); float alpha = intensity / 60f; Vec3 midPoint = startPos.add(difference.scale(distance)); diff --git a/src/main/java/com/sammy/malum/common/block/curiosities/spirit_crucible/CrucibleAccelerationData.java b/src/main/java/com/sammy/malum/common/block/curiosities/spirit_crucible/CrucibleAccelerationData.java index 07ae97a85..bb292c9cf 100644 --- a/src/main/java/com/sammy/malum/common/block/curiosities/spirit_crucible/CrucibleAccelerationData.java +++ b/src/main/java/com/sammy/malum/common/block/curiosities/spirit_crucible/CrucibleAccelerationData.java @@ -23,7 +23,7 @@ public CrucibleAccelerationData(ICatalyzerAccelerationTarget target, int lookupR Map typeCount = new HashMap<>(); for (ICrucibleAccelerator accelerator : nearbyAccelerators) { if (accelerator.canStartAccelerating()) { - if (accelerator.getTarget() == null || accelerator.getTarget().equals(target)) { + if (accelerator.getTarget() == null || accelerator.getTarget().equals(target) || (accelerator.getTarget() != null && !accelerator.getTarget().canBeAccelerated())) { var acceleratorType = accelerator.getAcceleratorType(); int max = acceleratorType.maximumEntries; int amount = typeCount.getOrDefault(acceleratorType, 0); @@ -79,6 +79,7 @@ public static CrucibleAccelerationData load(Level level, ICatalyzerAccelerationT typeCount.compute(accelerator.getAcceleratorType(), (type, count) -> count == null ? 1 : count + 1); data.addAccelerator(accelerator); accelerator.setTarget(target); + BlockHelper.updateState(level, pos); } } } diff --git a/src/main/java/com/sammy/malum/common/block/curiosities/spirit_crucible/catalyzer/SpiritCatalyzerCoreBlockEntity.java b/src/main/java/com/sammy/malum/common/block/curiosities/spirit_crucible/catalyzer/SpiritCatalyzerCoreBlockEntity.java index d6497b1ce..83a50f424 100644 --- a/src/main/java/com/sammy/malum/common/block/curiosities/spirit_crucible/catalyzer/SpiritCatalyzerCoreBlockEntity.java +++ b/src/main/java/com/sammy/malum/common/block/curiosities/spirit_crucible/catalyzer/SpiritCatalyzerCoreBlockEntity.java @@ -39,8 +39,8 @@ public class SpiritCatalyzerCoreBlockEntity extends MultiBlockCoreEntity impleme public LodestoneBlockEntityInventory inventory; public int burnTicks; - ICatalyzerAccelerationTarget target; public HashMap intensity; + protected ICatalyzerAccelerationTarget target; public SpiritCatalyzerCoreBlockEntity(BlockEntityType type, MultiBlockStructure structure, BlockPos pos, BlockState state) { super(type, structure, pos, state); @@ -102,24 +102,24 @@ public void tick() { } } if (level.isClientSide) { + if (intensity == null) { + intensity = new HashMap<>(); + } if (target != null) { - if (intensity == null) { - intensity = new HashMap<>(); + boolean canBeAccelerated = target.canBeAccelerated(); + MalumSpiritType activeSpiritType = target.getActiveSpiritType(); + if (activeSpiritType != null) { + intensity.putIfAbsent(activeSpiritType, 0); + if (canBeAccelerated) { + intensity.put(activeSpiritType, Math.min(60, intensity.get(activeSpiritType) + 1)); + } } - final boolean canBeAccelerated = target.canBeAccelerated(); - final MalumSpiritType activeSpiritType = target.getActiveSpiritType(); - intensity.putIfAbsent(activeSpiritType, 0); for (MalumSpiritType spiritType : intensity.keySet()) { if (canBeAccelerated && spiritType.equals(activeSpiritType)) { continue; } intensity.put(spiritType, Math.max(0,intensity.get(spiritType) - 1)); } - if (activeSpiritType != null) { - if (canBeAccelerated) { - intensity.put(activeSpiritType, Math.min(60, intensity.get(activeSpiritType) + 1)); - } - } } } } diff --git a/src/main/java/com/sammy/malum/visual_effects/RadiantParticleEffects.java b/src/main/java/com/sammy/malum/visual_effects/RadiantParticleEffects.java index 0361343d4..67940d540 100644 --- a/src/main/java/com/sammy/malum/visual_effects/RadiantParticleEffects.java +++ b/src/main/java/com/sammy/malum/visual_effects/RadiantParticleEffects.java @@ -85,7 +85,7 @@ public static void spitOutWeepingWellRadiance(Level level, PositionEffectData po int spinDirection = (rand.nextBoolean() ? 1 : -1); WorldParticleBuilder.create(LodestoneParticleRegistry.SPARKLE_PARTICLE) .setTransparencyData(GenericParticleData.create(0.1f, 0.4f, 0).setEasing(Easing.QUAD_IN, Easing.CIRC_IN).build()) - .setSpinData(SpinParticleData.create((0.125f + rand.nextFloat() * 0.075f) * spinDirection).setSpinOffset(spinOffset).build()) + .setSpinData(SpinParticleData.create((0.05f + rand.nextFloat() * 0.025f) * spinDirection).setSpinOffset(spinOffset).build()) .setScaleData(GenericParticleData.create(3f, 5f, 0.6f).setEasing(Easing.QUARTIC_OUT, Easing.SINE_IN).build()) .setColorData(colorData) .setLifeDelay(lifeDelay) diff --git a/src/main/java/com/sammy/malum/visual_effects/SpiritCrucibleParticleEffects.java b/src/main/java/com/sammy/malum/visual_effects/SpiritCrucibleParticleEffects.java index dcda9aaf9..ca7c23058 100644 --- a/src/main/java/com/sammy/malum/visual_effects/SpiritCrucibleParticleEffects.java +++ b/src/main/java/com/sammy/malum/visual_effects/SpiritCrucibleParticleEffects.java @@ -5,6 +5,7 @@ import com.sammy.malum.common.item.spirit.*; import com.sammy.malum.common.recipe.*; import com.sammy.malum.core.systems.spirit.*; +import com.sammy.malum.registry.client.*; import net.minecraft.core.*; import net.minecraft.util.*; import net.minecraft.world.item.*; @@ -14,10 +15,13 @@ import team.lodestar.lodestone.setup.*; import team.lodestar.lodestone.systems.blockentity.*; import team.lodestar.lodestone.systems.easing.*; +import team.lodestar.lodestone.systems.particle.*; import team.lodestar.lodestone.systems.particle.builder.*; +import team.lodestar.lodestone.systems.particle.data.*; import team.lodestar.lodestone.systems.particle.data.spin.*; import java.util.*; +import java.util.function.*; import static com.sammy.malum.visual_effects.SpiritLightSpecs.spiritLightSpecs; @@ -96,5 +100,20 @@ public static void spiritCatalyzerParticles(SpiritCatalyzerCoreBlockEntity catal sparkParticles.getBloomBuilder().setMotion(velocity); sparkParticles.spawnParticlesRaw(); } + if (level.getGameTime() % 10L == 0) { + velocity = targetPos.subtract(startPos).normalize().scale(0.05f); + final Consumer behavior = p -> p.setParticleMotion(p.getParticleSpeed().scale(0.98f)); + DirectionalParticleBuilder.create(ParticleRegistry.CIRCLE) + .setTransparencyData(GenericParticleData.create(0.6f, 0.2f, 0f).setEasing(Easing.SINE_IN_OUT, Easing.SINE_IN).build()) + .setScaleData(GenericParticleData.create(0.15f, 0).setEasing(Easing.SINE_IN_OUT).build()) + .setColorData(spiritType.createMainColorData().build()) + .setLifetime(60) + .setMotion(velocity) + .setDirection(velocity.normalize()) + .enableNoClip() + .setSpritePicker(SimpleParticleOptions.ParticleSpritePicker.RANDOM_SPRITE) + .addTickActor(behavior) + .spawn(level, startPos.x, startPos.y, startPos.z); + } } }