Skip to content

Commit

Permalink
Wawa
Browse files Browse the repository at this point in the history
  • Loading branch information
SammySemicolon committed Nov 21, 2023
1 parent df17404 commit e66b1c2
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public CrucibleAccelerationData(ICatalyzerAccelerationTarget target, int lookupR
Map<CrucibleAcceleratorType, Integer> 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);
Expand Down Expand Up @@ -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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public class SpiritCatalyzerCoreBlockEntity extends MultiBlockCoreEntity impleme

public LodestoneBlockEntityInventory inventory;
public int burnTicks;
ICatalyzerAccelerationTarget target;
public HashMap<MalumSpiritType, Integer> intensity;
protected ICatalyzerAccelerationTarget target;

public SpiritCatalyzerCoreBlockEntity(BlockEntityType<? extends SpiritCatalyzerCoreBlockEntity> type, MultiBlockStructure structure, BlockPos pos, BlockState state) {
super(type, structure, pos, state);
Expand Down Expand Up @@ -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));
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand All @@ -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;

Expand Down Expand Up @@ -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<LodestoneWorldParticleActor> 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);
}
}
}

0 comments on commit e66b1c2

Please sign in to comment.