139 lines
5.1 KiB
Java
139 lines
5.1 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package net.minecraft.client.particle;
|
|
|
|
import net.minecraft.client.multiplayer.ClientLevel;
|
|
import net.minecraft.client.particle.Particle;
|
|
import net.minecraft.client.particle.ParticleProvider;
|
|
import net.minecraft.client.particle.SingleQuadParticle;
|
|
import net.minecraft.client.particle.SpriteSet;
|
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
|
import net.minecraft.core.particles.SimpleParticleType;
|
|
import net.minecraft.util.RandomSource;
|
|
|
|
public class SuspendedTownParticle
|
|
extends SingleQuadParticle {
|
|
private SuspendedTownParticle(ClientLevel level, double x, double y, double z, double xa, double ya, double za, TextureAtlasSprite sprite) {
|
|
super(level, x, y, z, xa, ya, za, sprite);
|
|
float br;
|
|
this.rCol = br = this.random.nextFloat() * 0.1f + 0.2f;
|
|
this.gCol = br;
|
|
this.bCol = br;
|
|
this.setSize(0.02f, 0.02f);
|
|
this.quadSize *= this.random.nextFloat() * 0.6f + 0.5f;
|
|
this.xd *= (double)0.02f;
|
|
this.yd *= (double)0.02f;
|
|
this.zd *= (double)0.02f;
|
|
this.lifetime = (int)(20.0 / (Math.random() * 0.8 + 0.2));
|
|
}
|
|
|
|
@Override
|
|
public SingleQuadParticle.Layer getLayer() {
|
|
return SingleQuadParticle.Layer.OPAQUE;
|
|
}
|
|
|
|
@Override
|
|
public void move(double xa, double ya, double za) {
|
|
this.setBoundingBox(this.getBoundingBox().move(xa, ya, za));
|
|
this.setLocationFromBoundingbox();
|
|
}
|
|
|
|
@Override
|
|
public void tick() {
|
|
this.xo = this.x;
|
|
this.yo = this.y;
|
|
this.zo = this.z;
|
|
if (this.lifetime-- <= 0) {
|
|
this.remove();
|
|
return;
|
|
}
|
|
this.move(this.xd, this.yd, this.zd);
|
|
this.xd *= 0.99;
|
|
this.yd *= 0.99;
|
|
this.zd *= 0.99;
|
|
}
|
|
|
|
public static class EggCrackProvider
|
|
implements ParticleProvider<SimpleParticleType> {
|
|
private final SpriteSet sprite;
|
|
|
|
public EggCrackProvider(SpriteSet sprite) {
|
|
this.sprite = sprite;
|
|
}
|
|
|
|
@Override
|
|
public Particle createParticle(SimpleParticleType options, ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, RandomSource random) {
|
|
SuspendedTownParticle particle = new SuspendedTownParticle(level, x, y, z, xAux, yAux, zAux, this.sprite.get(random));
|
|
particle.setColor(1.0f, 1.0f, 1.0f);
|
|
return particle;
|
|
}
|
|
}
|
|
|
|
public static class DolphinSpeedProvider
|
|
implements ParticleProvider<SimpleParticleType> {
|
|
private final SpriteSet sprite;
|
|
|
|
public DolphinSpeedProvider(SpriteSet sprite) {
|
|
this.sprite = sprite;
|
|
}
|
|
|
|
@Override
|
|
public Particle createParticle(SimpleParticleType options, ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, RandomSource random) {
|
|
SuspendedTownParticle particle = new SuspendedTownParticle(level, x, y, z, xAux, yAux, zAux, this.sprite.get(random));
|
|
particle.setColor(0.3f, 0.5f, 1.0f);
|
|
particle.setAlpha(1.0f - random.nextFloat() * 0.7f);
|
|
particle.setLifetime(particle.getLifetime() / 2);
|
|
return particle;
|
|
}
|
|
}
|
|
|
|
public static class ComposterFillProvider
|
|
implements ParticleProvider<SimpleParticleType> {
|
|
private final SpriteSet sprite;
|
|
|
|
public ComposterFillProvider(SpriteSet sprite) {
|
|
this.sprite = sprite;
|
|
}
|
|
|
|
@Override
|
|
public Particle createParticle(SimpleParticleType options, ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, RandomSource random) {
|
|
SuspendedTownParticle particle = new SuspendedTownParticle(level, x, y, z, xAux, yAux, zAux, this.sprite.get(random));
|
|
particle.setColor(1.0f, 1.0f, 1.0f);
|
|
particle.setLifetime(3 + level.getRandom().nextInt(5));
|
|
return particle;
|
|
}
|
|
}
|
|
|
|
public static class HappyVillagerProvider
|
|
implements ParticleProvider<SimpleParticleType> {
|
|
private final SpriteSet sprite;
|
|
|
|
public HappyVillagerProvider(SpriteSet sprite) {
|
|
this.sprite = sprite;
|
|
}
|
|
|
|
@Override
|
|
public Particle createParticle(SimpleParticleType options, ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, RandomSource random) {
|
|
SuspendedTownParticle particle = new SuspendedTownParticle(level, x, y, z, xAux, yAux, zAux, this.sprite.get(random));
|
|
particle.setColor(1.0f, 1.0f, 1.0f);
|
|
return particle;
|
|
}
|
|
}
|
|
|
|
public static class Provider
|
|
implements ParticleProvider<SimpleParticleType> {
|
|
private final SpriteSet sprite;
|
|
|
|
public Provider(SpriteSet sprite) {
|
|
this.sprite = sprite;
|
|
}
|
|
|
|
@Override
|
|
public Particle createParticle(SimpleParticleType options, ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, RandomSource random) {
|
|
return new SuspendedTownParticle(level, x, y, z, xAux, yAux, zAux, this.sprite.get(random));
|
|
}
|
|
}
|
|
}
|
|
|