diff --git a/src/client/java/org/ladysnake/effective/core/particle/CascadeParticle.java b/src/client/java/org/ladysnake/effective/core/particle/CascadeParticle.java index d5781a1..4d9d953 100644 --- a/src/client/java/org/ladysnake/effective/core/particle/CascadeParticle.java +++ b/src/client/java/org/ladysnake/effective/core/particle/CascadeParticle.java @@ -34,8 +34,6 @@ public ParticleTextureSheet getType() { public void tick() { super.tick(); - this.setSpriteForAge(this.spriteProvider); - this.prevPosX = this.x; this.prevPosY = this.y; this.prevPosZ = this.z; @@ -57,6 +55,8 @@ public void tick() { this.velocityZ *= 0.95f; this.move(velocityX, velocityY, velocityZ); + + this.setSpriteForAge(this.spriteProvider); } @Environment(EnvType.CLIENT) diff --git a/src/client/java/org/ladysnake/effective/core/particle/RippleParticle.java b/src/client/java/org/ladysnake/effective/core/particle/RippleParticle.java index 762bf68..8c35555 100644 --- a/src/client/java/org/ladysnake/effective/core/particle/RippleParticle.java +++ b/src/client/java/org/ladysnake/effective/core/particle/RippleParticle.java @@ -8,9 +8,7 @@ import net.minecraft.client.world.ClientWorld; import net.minecraft.particle.SimpleParticleType; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; import org.joml.Quaternionf; -import org.joml.Vector3f; import java.util.Random; @@ -20,12 +18,13 @@ public class RippleParticle extends SpriteBillboardParticle { public RippleParticle(ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ, SpriteProvider spriteProvider) { super(world, x, y, z, velocityX, velocityY, velocityZ); + this.spriteProvider = spriteProvider; + this.setSpriteForAge(spriteProvider); + this.velocityX = 0; this.velocityY = 0; this.velocityZ = 0; - this.spriteProvider = spriteProvider; - int scaleAgeModifier = 1 + new Random().nextInt(10); this.scale *= 2f + random.nextFloat() / 10f * scaleAgeModifier; this.maxAge = 10 + new Random().nextInt(scaleAgeModifier); @@ -44,47 +43,15 @@ public void tick() { if (this.age++ >= this.maxAge) { this.markDead(); } + + this.setSpriteForAge(spriteProvider); } @Override public void buildGeometry(VertexConsumer vertexConsumer, Camera camera, float tickDelta) { - this.setSpriteForAge(spriteProvider); - - Vec3d vec3d = camera.getPos(); - float f = (float) (MathHelper.lerp(tickDelta, this.prevPosX, this.x) - vec3d.getX()); - float g = (float) (MathHelper.lerp(tickDelta, this.prevPosY, this.y) - vec3d.getY()); - float h = (float) (MathHelper.lerp(tickDelta, this.prevPosZ, this.z) - vec3d.getZ()); - Quaternionf quaternion2; - if (this.angle == 0.0F) { - quaternion2 = camera.getRotation(); - } else { - quaternion2 = new Quaternionf(camera.getRotation()); - float i = MathHelper.lerp(tickDelta, this.prevAngle, this.angle); - quaternion2.rotateZ(i); - } - - Vector3f vec3f = new Vector3f(-1.0F, -1.0F, 0.0F); - vec3f.rotate(quaternion2); - Vector3f[] Vec3fs = new Vector3f[]{new Vector3f(-1.0F, -1.0F, 0.0F), new Vector3f(-1.0F, 1.0F, 0.0F), new Vector3f(1.0F, 1.0F, 0.0F), new Vector3f(1.0F, -1.0F, 0.0F)}; - float j = this.getSize(tickDelta); - - for (int k = 0; k < 4; ++k) { - Vector3f Vec3f2 = Vec3fs[k]; - Vec3f2.rotate(new Quaternionf().rotateXYZ((float) Math.toRadians(90f), 0f, 0f)); - Vec3f2.mul(j); - Vec3f2.add(f, g, h); - } - - float minU = this.getMinU(); - float maxU = this.getMaxU(); - float minV = this.getMinV(); - float maxV = this.getMaxV(); - int l = this.getBrightness(tickDelta); - - vertexConsumer.vertex(Vec3fs[0].x(), Vec3fs[0].y(), Vec3fs[0].z()).texture(maxU, maxV).color(red, green, blue, alpha).light(l); - vertexConsumer.vertex(Vec3fs[1].x(), Vec3fs[1].y(), Vec3fs[1].z()).texture(maxU, minV).color(red, green, blue, alpha).light(l); - vertexConsumer.vertex(Vec3fs[2].x(), Vec3fs[2].y(), Vec3fs[2].z()).texture(minU, minV).color(red, green, blue, alpha).light(l); - vertexConsumer.vertex(Vec3fs[3].x(), Vec3fs[3].y(), Vec3fs[3].z()).texture(minU, maxV).color(red, green, blue, alpha).light(l); + Quaternionf quaternionf = new Quaternionf(); + quaternionf.rotateX((float) Math.toRadians(-90f)); + this.method_60373(vertexConsumer, camera, quaternionf, tickDelta); } @Environment(EnvType.CLIENT)