Skip to content
This repository has been archived by the owner on Aug 25, 2024. It is now read-only.

Commit

Permalink
Make prismarine crystal become flat when on ground
Browse files Browse the repository at this point in the history
  • Loading branch information
doctor4t committed Nov 8, 2021
1 parent d5f7272 commit 6baefa9
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class PrismarineCrystalParticle extends SpriteBillboardParticle {
protected final float rotationFactor;
private final int variant = RANDOM.nextInt(3);
private final SpriteProvider spriteProvider;
private final float groundOffset;

public PrismarineCrystalParticle(ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ, SpriteProvider spriteProvider) {
super(world, x, y, z, velocityX, velocityY, velocityZ);
Expand All @@ -36,6 +37,8 @@ public PrismarineCrystalParticle(ClientWorld world, double x, double y, double z
this.velocityY = -random.nextFloat() * 0.01d;
this.velocityZ = random.nextFloat() * 0.01d;

this.groundOffset = RANDOM.nextFloat() / 100f + 0.001f;

this.rotationFactor = ((float) Math.random() - 0.5F) * 0.01F;
this.angle = random.nextFloat() * 360f;
}
Expand All @@ -62,9 +65,13 @@ public void buildGeometry(VertexConsumer vertexConsumer, Camera camera, float ti

for (int k = 0; k < 4; ++k) {
Vec3f Vec3f2 = Vec3fs[k];
Vec3f2.rotate(quaternion2);
if (this.onGround) {
Vec3f2.rotate(new Quaternion(90f, 0f, quaternion2.getZ(), true));
} else {
Vec3f2.rotate(quaternion2);
}
Vec3f2.scale(j);
Vec3f2.add(f, g, h);
Vec3f2.add(f, g + this.groundOffset, h);
}

float minU = this.getMinU();
Expand All @@ -73,7 +80,7 @@ public void buildGeometry(VertexConsumer vertexConsumer, Camera camera, float ti
float maxV = this.getMaxV();
int l = 15728880;

this.colorRed = 0.8f + (float) Math.sin(this.age/100f) * 0.2f;
this.colorRed = 0.8f + (float) Math.sin(this.age / 100f) * 0.2f;
// this.colorBlue = 0.9f + (float) Math.cos(this.age/100f) * 0.1f;

vertexConsumer.vertex(Vec3fs[0].getX(), Vec3fs[0].getY(), Vec3fs[0].getZ()).texture(maxU, maxV).color(colorRed, colorGreen, colorBlue, colorAlpha).light(l).next();
Expand Down

0 comments on commit 6baefa9

Please sign in to comment.