Skip to content

Commit

Permalink
F & D
Browse files Browse the repository at this point in the history
  • Loading branch information
AViewFromTheTop committed Nov 7, 2023
1 parent 4b477c9 commit 4c045d9
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public class FallingParticle extends TextureSheetParticle {

FallingParticle(@NotNull ClientLevel level, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed, @NotNull SpriteSet spriteProvider) {
this(level, x, y, z, spriteProvider);
this.xd *= 0.1f;
this.yd *= 0.1f;
this.zd *= 0.1f;
this.xd *= 0.1F;
this.yd *= 0.1F;
this.zd *= 0.1F;
this.xd += xSpeed;
this.yd += ySpeed;
this.zd += zSpeed;
Expand All @@ -48,7 +48,7 @@ public FallingParticle(@NotNull ClientLevel level, double x, double y, double z,
super(level, x, y, z, 0.0, 0.0, 0.0);
this.spriteProvider = spriteProvider;
this.setSpriteFromAge(spriteProvider);
this.gravity = 1.0f;
this.gravity = 1.0F;
this.quadSize = 0.2F;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public class FloatingSculkBubbleParticle extends RisingParticle {
private final SoundEvent sound;
private final int stayInflatedTime;

private float currentInflation = 0;
private float targetInflation = 2;
private float currentInflation = 0F;
private float targetInflation = 2F;

protected FloatingSculkBubbleParticle(@NotNull ClientLevel clientLevel, double x, double y, double z, double size, int maxAge, @NotNull Vec3 velocity, @NotNull SpriteSet spriteProvider) {
super(clientLevel, x, y, z, 0, 0, 0);
Expand Down Expand Up @@ -85,21 +85,21 @@ public void setSpriteFromAge(@NotNull SpriteSet spriteProvider) {
public void tick() {
super.tick();
Vec3 wind = ClientWindManager.getWindMovement(this.level, BlockPos.containing(this.x, this.y, this.z), 1.5).scale(MiscConfig.get().getParticleWindIntensity());
this.xd += wind.x * 0.001;
this.yd += wind.y * 0.00005;
this.zd += wind.z * 0.001;
this.xd += wind.x * 0.001D;
this.yd += wind.y * 0.00005D;
this.zd += wind.z * 0.001D;
int flateAge = this.age - (this.stayInflatedTime) + 4;
switch (this.age) {
case 1 -> {
this.currentInflation = 0;
this.targetInflation = 2;
}
case 2 -> {
this.currentInflation = 1;
this.currentInflation = 1F;
this.targetInflation = 1.4F;
}
case 3 -> {
this.currentInflation = 1;
this.currentInflation = 1F;
this.targetInflation = 1.3F;
}
case 4 -> {
Expand All @@ -124,7 +124,7 @@ public void tick() {
}
case 9 -> {
this.currentInflation = 0.95F;
this.targetInflation = 1;
this.targetInflation = 1F;
}
default -> {
switch (flateAge) {
Expand Down Expand Up @@ -153,16 +153,16 @@ public void tick() {
this.targetInflation = 1.65F;
}
default -> {
this.currentInflation = 1;
this.targetInflation = 1;
this.currentInflation = 1F;
this.targetInflation = 1F;
}
}
}
}

if (this.age == this.stayInflatedTime + 1) {
level.playSound(Minecraft.getInstance().player, this.x, this.y, this.z, this.sound, SoundSource.NEUTRAL, 0.4F, level.random.nextFloat() * 0.2F + 0.8F);
this.setParticleSpeed(0, 0, 0);
this.setParticleSpeed(0D, 0D, 0D);
}
this.setSpriteFromAge(this.spriteProvider);
}
Expand All @@ -183,7 +183,7 @@ public BubbleFactory(SpriteSet spriteProvider) {
@Override
public Particle createParticle(@NotNull FloatingSculkBubbleParticleOptions options, @NotNull ClientLevel clientLevel, double x, double y, double z, double xd, double yd, double zd) {
FloatingSculkBubbleParticle bubble = new FloatingSculkBubbleParticle(clientLevel, x, y, z, options.getSize(), options.getMaxAge(), options.getVelocity(), this.spriteProvider);
bubble.setAlpha(1.0F);
bubble.setAlpha(1F);
return bubble;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,19 @@ public void render(@NotNull VertexConsumer buffer, @NotNull Camera renderInfo, f
float f = (float) (Mth.lerp(partialTicks, this.xo, this.x) - vec3.x());
float g = (float) (Mth.lerp(partialTicks, this.yo, this.y) - vec3.y());
float h = (float) (Mth.lerp(partialTicks, this.zo, this.z) - vec3.z());
this.rotation.set(0.0f, 0.0f, 0.0f, 1.0f);
this.rotation.set(0F, 0F, 0F, 1F);
this.rotation.mul(Axis.YP.rotationDegrees(-renderInfo.getYRot()));
this.rotation.mul(Axis.XP.rotationDegrees(renderInfo.getXRot() * (Mth.lerp(partialTicks, this.prevXRotMultiplier, this.xRotMultiplier))));
if (this.roll != 0.0f) {
float i = Mth.lerp(partialTicks, this.oRoll, this.roll);
this.rotation.mul(Axis.ZP.rotation(i));
}
Vector3f[] vector3fs = 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)};
Vector3f[] vector3fs = new Vector3f[]{
new Vector3f(-1F, -1F, 0F),
new Vector3f(-1F, 1F, 0F),
new Vector3f(1F, 1F, 0F),
new Vector3f(1F, -1F, 0F)
};
float j = this.getQuadSize(partialTicks);
for (int k = 0; k < 4; ++k) {
Vector3f vector3f2 = vector3fs[k];
Expand Down Expand Up @@ -523,10 +528,10 @@ static class FallAndLandParticle extends MesogleaDripParticle.FallingParticle {
protected void postMoveUpdate() {
if (this.onGround) {
this.remove();
this.level.addParticle(this.landParticle, this.x, this.y, this.z, 0.0, 0.0, 0.0);
this.level.addParticle(this.landParticle, this.x, this.y, this.z, 0D, 0D, 0D);
SoundEvent soundEvent = RegisterSounds.PARTICLE_MESOGLEA_DRIP_LAND;
float f = Mth.randomBetween(this.random, 0.3F, 1.0F);
this.level.playLocalSound(this.x, this.y, this.z, soundEvent, SoundSource.BLOCKS, f, 1.0F, false);
float f = Mth.randomBetween(this.random, 0.3F, 1F);
this.level.playLocalSound(this.x, this.y, this.z, soundEvent, SoundSource.BLOCKS, f, 1F, false);
}
}
}
Expand All @@ -537,7 +542,7 @@ static class DripHangParticle extends MesogleaDripParticle {
private final SpriteSet spriteSet;

DripHangParticle(@NotNull ClientLevel clientLevel, double d, double e, double f, ParticleOptions particleOptions, SpriteSet spriteSet) {
super(clientLevel, d, e - 0.1, f);
super(clientLevel, d, e - 0.1D, f);
this.fallingParticle = particleOptions;
this.gravity *= 0.00F;
this.lifetime = 40;
Expand All @@ -557,7 +562,7 @@ protected void preMoveUpdate() {
@Override
protected void postMoveUpdate() {
if (!this.removed) {
this.setSprite(spriteSet.get((int) (this.age * 0.2) + 1, (int) (this.lifetime * 0.2) + 1));
this.setSprite(spriteSet.get((int) (this.age * 0.2D) + 1, (int) (this.lifetime * 0.2D) + 1));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public void tick() {
this.yd *= this.friction;
this.zd *= this.friction;
if (this.onGround) {
this.xd *= 0.7f;
this.zd *= 0.7f;
this.xd *= 0.7F;
this.zd *= 0.7F;
}
this.prevScale = this.scale;
this.scale += (this.targetScale - this.scale) * 0.15F;
Expand All @@ -100,11 +100,11 @@ public void tick() {
this.windIntensity *= 0.945F;
boolean onGround = this.onGround;
if (!rain) {
double multXZ = (onGround ? 0.0005 : 0.007) * this.windIntensity;
double multY = (onGround ? 0.0005 : 0.0035) * this.windIntensity;
double multXZ = (onGround ? 0.0005D : 0.007D) * this.windIntensity;
double multY = (onGround ? 0.0005D : 0.0035D) * this.windIntensity;
Vec3 wind = ClientWindManager.getWindMovement(this.level, BlockPos.containing(this.x, this.y, this.z)).scale(MiscConfig.get().getParticleWindIntensity());
this.xd += wind.x() * multXZ;
this.yd += (wind.y() + 0.1) * multY;
this.yd += (wind.y() + 0.1D) * multY;
this.zd += wind.z() * multXZ;
}
} else {
Expand All @@ -128,11 +128,11 @@ public record PollenFactory(@NotNull SpriteSet spriteProvider) implements Partic
@Override
@NotNull
public Particle createParticle(@NotNull SimpleParticleType defaultParticleType, @NotNull ClientLevel clientLevel, double x, double y, double z, double g, double h, double i) {
PollenParticle pollenParticle = new PollenParticle(clientLevel, this.spriteProvider, x, y, z, 0.0D, -0.800000011920929D, 0.0D);
PollenParticle pollenParticle = new PollenParticle(clientLevel, this.spriteProvider, x, y, z, 0D, -0.800000011920929D, 0D);
pollenParticle.lifetime = Mth.randomBetweenInclusive(clientLevel.random, 500, 1000);
pollenParticle.gravity = 0.01F;
pollenParticle.setColor(250F / 255F, 171F / 255F, 28F / 255F);
pollenParticle.windIntensity = 0.05;
pollenParticle.windIntensity = 0.05D;
return pollenParticle;
}
}
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/net/frozenblock/wilderwild/particle/SeedParticle.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public class SeedParticle extends TextureSheetParticle {
this.quadSize *= this.random.nextFloat() * 0.6F + 0.6F;
this.lifetime = (int) (16.0D / (AdvancedMath.random().nextDouble() * 0.8D + 0.2D));
this.hasPhysics = true;
this.friction = 1.0F;
this.gravity = 0.0F;
this.friction = 1F;
this.gravity = 0F;
}

@Override
Expand All @@ -60,11 +60,11 @@ public void tick() {
if (!fluidState.isEmpty() && (fluidState.getHeight(this.level, blockPos) + (float) blockPos.getY()) >= this.y) {
return;
}
double multXZ = (this.onGround ? 0.0005 : 0.007) * this.windIntensity;
double multY = (this.onGround ? 0.0005 : 0.0035) * this.windIntensity;
double multXZ = (this.onGround ? 0.0005D : 0.007D) * this.windIntensity;
double multY = (this.onGround ? 0.0005D : 0.0035D) * this.windIntensity;
Vec3 wind = ClientWindManager.getWindMovement(this.level, BlockPos.containing(this.x, this.y, this.z)).scale(MiscConfig.get().getParticleWindIntensity());
this.xd += wind.x() * multXZ;
this.yd += (wind.y() + 0.1) * multY;
this.yd += (wind.y() + 0.1D) * multY;
this.zd += wind.z() * multXZ;
}

Expand All @@ -79,16 +79,16 @@ public record Factory(@NotNull SpriteSet spriteProvider) implements ParticleProv
@Override
@NotNull
public Particle createParticle(@NotNull SeedParticleOptions options, @NotNull ClientLevel level, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
double windex = options.isControlled() ? xSpeed * 1.1 : ClientWindManager.getWindX(1) * 1.1;
double windZ = options.isControlled() ? zSpeed * 1.1 : ClientWindManager.getWindZ(1) * 1.1;
double windex = options.isControlled() ? xSpeed * 1.1D : ClientWindManager.getWindX(1F) * 1.1D;
double windZ = options.isControlled() ? zSpeed * 1.1D : ClientWindManager.getWindZ(1F) * 1.1D;
SeedParticle seedParticle = new SeedParticle(level, this.spriteProvider, x, y, z, windex, -0.800000011920929D, windZ);
seedParticle.lifetime = Mth.randomBetweenInclusive(level.random, 500, 1000);
seedParticle.gravity = 0.01F;
seedParticle.xd = (windex + level.random.triangle(0, 0.8)) / 17;
seedParticle.zd = (windZ + level.random.triangle(0, 0.8)) / 17;
seedParticle.xd = (windex + level.random.triangle(0D, 0.8D)) / 17D;
seedParticle.zd = (windZ + level.random.triangle(0D, 0.8D)) / 17D;
seedParticle.yd = options.isControlled() ? ySpeed / 17 : seedParticle.yd;
seedParticle.setColor(250F / 255F, 250F / 255F, 250F / 255F);
seedParticle.windIntensity = options.isControlled() ? 0.5 : 1;
seedParticle.windIntensity = options.isControlled() ? 0.5D : 1D;
return seedParticle;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,12 @@ public void render(@NotNull VertexConsumer buffer, @NotNull Camera renderInfo, f
float i = Mth.lerp(partialTicks, this.oRoll, this.roll);
quaternion.mul(Axis.ZP.rotation(i));
}
Vector3f[] vector3fs = 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)};
Vector3f[] vector3fs = new Vector3f[]{
new Vector3f(-1F, -1F, 0F),
new Vector3f(-1F, 1F, 0F),
new Vector3f(1F, 1F, 0F),
new Vector3f(1F, -1F, 0F)
};
float j = this.getQuadSize(partialTicks);
for (int k = 0; k < 4; ++k) {
Vector3f vector3f2 = vector3fs[k];
Expand Down

0 comments on commit 4c045d9

Please sign in to comment.