Skip to content

Commit

Permalink
More Work on Radiant Particles
Browse files Browse the repository at this point in the history
  • Loading branch information
SammySemicolon committed Oct 29, 2023
1 parent 859028a commit 8a85e21
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,16 @@ public void render(VoidConduitBlockEntity blockEntityIn, float partialTicks, Pos
}

public void renderQuad(VoidConduitBlockEntity voidConduit, PoseStack poseStack, float partialTicks) {
float height = 0.75f;
float width = 1.5f;
VertexConsumer textureConsumer = RenderHandler.DELAYED_RENDER.getBuffer(LodestoneRenderTypeRegistry.TRANSPARENT_TEXTURE.applyAndCache(VIGNETTE));
Vector3f[] positions = new Vector3f[]{new Vector3f(-width, height, width), new Vector3f(width, height, width), new Vector3f(width, height, -width), new Vector3f(-width, height, -width)};
VFXBuilders.WorldVFXBuilder builder = VFXBuilders.createWorld().setPosColorTexLightmapDefaultFormat();

poseStack.pushPose();
poseStack.translate(0.5f, 0.001f, 0.5f);
builder.renderQuad(textureConsumer, poseStack, positions, 1f);
poseStack.popPose();
if (voidConduit.lingeringRadiance == 0) {
float height = 0.75f;
float width = 1.5f;
VertexConsumer textureConsumer = RenderHandler.DELAYED_RENDER.getBuffer(LodestoneRenderTypeRegistry.TRANSPARENT_TEXTURE.applyAndCache(VIGNETTE));
Vector3f[] positions = new Vector3f[]{new Vector3f(-width, height, width), new Vector3f(width, height, width), new Vector3f(width, height, -width), new Vector3f(-width, height, -width)};
VFXBuilders.WorldVFXBuilder builder = VFXBuilders.createWorld().setPosColorTexLightmapDefaultFormat();
poseStack.pushPose();
poseStack.translate(0.5f, 0.001f, 0.5f);
builder.renderQuad(textureConsumer, poseStack, positions, 1f);
poseStack.popPose();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
public class WeepingWellParticleEffects {

public static final List<Color> RADIANT_COLORS = List.of(
new Color(249, 206, 77),
new Color(145, 42, 247),
new Color(48, 208, 242));
new Color(179, 35, 218),
new Color(224, 210, 68),
new Color(42, 146, 218));

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();
Expand Down Expand Up @@ -84,25 +84,28 @@ public static void passiveWeepingWellParticles(VoidConduitBlockEntity voidCondui
public static void radiantWeepingWellParticles(VoidConduitBlockEntity voidConduit) {
Level level = voidConduit.getLevel();
Random rand = level.random;
Color color = RADIANT_COLORS.get(((int) level.getGameTime() % 18) / 6);
Color color = RADIANT_COLORS.get(((int) level.getGameTime() % 27) / 9);
final BlockPos blockPos = voidConduit.getBlockPos();
final ColorParticleData colorData = ColorParticleData.create(color, color.darker()).setCoefficient(0.5f).build();

if (level.getGameTime() % 6L == 0) {
final ColorParticleData colorData = ColorParticleData.create(color.brighter(), color).setCoefficient(0.5f).build();
if (level.getGameTime() % 3L == 0) {
final GenericParticleData scaleData = GenericParticleData.create(0.1f, RandomHelper.randomBetween(rand, 1.7f, 1.8f), 0.5f).setEasing(Easing.SINE_OUT, Easing.SINE_IN).setCoefficient(RandomHelper.randomBetween(rand, 1f, 1.25f)).build();
final Consumer<LodestoneWorldParticleActor> 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);
float yMotion = RandomHelper.randomBetween(rand, 0.04f, 0.06f);
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())
.setTransparencyData(GenericParticleData.create(0.9f, 0.05f, 0f).setEasing(Easing.CUBIC_OUT, Easing.EXPO_IN).build())
.setScaleData(scaleData)
.setColorData(colorData)
.setLifetime(lifetime)
.setLifetime(100)
.setMotion(motion)
.setDirection(motion.normalize())
.enableNoClip()
.setSpritePicker(SimpleParticleOptions.ParticleSpritePicker.RANDOM_SPRITE)
.addActor(slowDown)
.spawn(level, blockPos.getX() + 0.5f, blockPos.getY() + 0.75f, blockPos.getZ() + 0.5f);
.spawn(level, blockPos.getX() + 0.5f, blockPos.getY() + 0.75f, blockPos.getZ() + 0.5f)
.setTransparencyData(GenericParticleData.create(0.1f, 0.6f, 0f).setEasing(Easing.CUBIC_OUT, Easing.EXPO_OUT).build())
.setRenderType(LodestoneWorldParticleRenderType.LUMITRANSPARENT)
.spawn(level, blockPos.getX() + 0.5f, blockPos.getY() + 0.65f, blockPos.getZ() + 0.5f);
}

final float acceleration = RandomHelper.randomBetween(rand, 0.002f, 0.02f);
Expand All @@ -112,8 +115,8 @@ public static void radiantWeepingWellParticles(VoidConduitBlockEntity voidCondui
p.setParticleMotion(p.getParticleSpeed().add(0, acceleration, 0));
}
};
if (level.getGameTime() % 2 == 0) {
int rotation = (int) (level.getGameTime() / 2f % 16);
if (level.getGameTime() % 2L == 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);
Expand Down
Binary file modified src/main/resources/assets/malum/textures/particle/square0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/assets/malum/textures/particle/square1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/assets/malum/textures/particle/square2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8a85e21

Please sign in to comment.