80 lines
2.5 KiB
Java
80 lines
2.5 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.core.particles.SimpleParticleType;
|
|
import net.minecraft.util.Mth;
|
|
import net.minecraft.util.RandomSource;
|
|
|
|
public class TrialSpawnerDetectionParticle
|
|
extends SingleQuadParticle {
|
|
private final SpriteSet sprites;
|
|
private static final int BASE_LIFETIME = 8;
|
|
|
|
protected TrialSpawnerDetectionParticle(ClientLevel level, double x, double y, double z, double xa, double ya, double za, float scale, SpriteSet sprites) {
|
|
super(level, x, y, z, 0.0, 0.0, 0.0, sprites.first());
|
|
this.sprites = sprites;
|
|
this.friction = 0.96f;
|
|
this.gravity = -0.1f;
|
|
this.speedUpWhenYMotionIsBlocked = true;
|
|
this.xd *= 0.0;
|
|
this.yd *= 0.9;
|
|
this.zd *= 0.0;
|
|
this.xd += xa;
|
|
this.yd += ya;
|
|
this.zd += za;
|
|
this.quadSize *= 0.75f * scale;
|
|
this.lifetime = (int)(8.0f / Mth.randomBetween(this.random, 0.5f, 1.0f) * scale);
|
|
this.lifetime = Math.max(this.lifetime, 1);
|
|
this.setSpriteFromAge(sprites);
|
|
this.hasPhysics = true;
|
|
}
|
|
|
|
@Override
|
|
public SingleQuadParticle.Layer getLayer() {
|
|
return SingleQuadParticle.Layer.OPAQUE;
|
|
}
|
|
|
|
@Override
|
|
public int getLightColor(float a) {
|
|
return 240;
|
|
}
|
|
|
|
@Override
|
|
public SingleQuadParticle.FacingCameraMode getFacingCameraMode() {
|
|
return SingleQuadParticle.FacingCameraMode.LOOKAT_Y;
|
|
}
|
|
|
|
@Override
|
|
public void tick() {
|
|
super.tick();
|
|
this.setSpriteFromAge(this.sprites);
|
|
}
|
|
|
|
@Override
|
|
public float getQuadSize(float a) {
|
|
return this.quadSize * Mth.clamp(((float)this.age + a) / (float)this.lifetime * 32.0f, 0.0f, 1.0f);
|
|
}
|
|
|
|
public static class Provider
|
|
implements ParticleProvider<SimpleParticleType> {
|
|
private final SpriteSet sprites;
|
|
|
|
public Provider(SpriteSet sprites) {
|
|
this.sprites = sprites;
|
|
}
|
|
|
|
@Override
|
|
public Particle createParticle(SimpleParticleType options, ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, RandomSource random) {
|
|
return new TrialSpawnerDetectionParticle(level, x, y, z, xAux, yAux, zAux, 1.5f, this.sprites);
|
|
}
|
|
}
|
|
}
|
|
|