Fixes, particle behavior
This commit is contained in:
parent
31ced5c19d
commit
34800a80c3
8 changed files with 49 additions and 47 deletions
|
@ -9,23 +9,49 @@ import net.minecraft.client.particle.SpriteBillboardParticle;
|
|||
import net.minecraft.client.particle.SpriteProvider;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.particle.DefaultParticleType;
|
||||
import net.minecraft.util.math.BlockPos.Mutable;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class ParticleGeyser extends SpriteBillboardParticle {
|
||||
private Mutable mut = new Mutable();
|
||||
private boolean changeDir = false;
|
||||
private boolean check = true;
|
||||
|
||||
protected ParticleGeyser(ClientWorld world, double x, double y, double z, double vx, double vy, double vz, SpriteProvider sprites) {
|
||||
super(world, x, y, z, vx, vy, vz);
|
||||
setSprite(sprites);
|
||||
this.maxAge = MHelper.randRange(600, 1200, random);
|
||||
this.maxAge = MHelper.randRange(400, 800, random);
|
||||
this.scale = MHelper.randRange(0.5F, 1.0F, random);
|
||||
this.velocityX = vx;
|
||||
this.velocityZ = vz;
|
||||
this.prevPosY = y - 0.125;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
if (this.age >= this.maxAge + 40) {
|
||||
this.setColorAlpha((this.maxAge - this.age) / 40F);
|
||||
|
||||
if (this.prevPosY == this.y || this.age > this.maxAge) {
|
||||
this.markDead();
|
||||
}
|
||||
else {
|
||||
if (this.age >= this.maxAge - 200) {
|
||||
this.setColorAlpha((this.maxAge - this.age) / 200F);
|
||||
}
|
||||
|
||||
this.scale += 0.005F;
|
||||
this.velocityY = 0.125;
|
||||
|
||||
if (changeDir) {
|
||||
changeDir = false;
|
||||
this.velocityX += MHelper.randRange(-0.2, 0.2, random);
|
||||
this.velocityZ += MHelper.randRange(-0.2, 0.2, random);
|
||||
}
|
||||
else if (check) {
|
||||
changeDir = world.getBlockState(mut).getFluidState().isEmpty();
|
||||
check = !changeDir;
|
||||
}
|
||||
}
|
||||
this.velocityY = 0.125;
|
||||
super.tick();
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ public class ParticleSulphur extends SpriteBillboardParticle {
|
|||
if (this.age <= 40) {
|
||||
this.setColorAlpha(this.age / 40F);
|
||||
}
|
||||
else if (this.age >= this.maxAge + 40) {
|
||||
else if (this.age >= this.maxAge - 40) {
|
||||
this.setColorAlpha((this.maxAge - this.age) / 40F);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue