ShriekParticle.java

net.minecraft.client.particle.ShriekParticle

信息

  • 全限定名:net.minecraft.client.particle.ShriekParticle
  • 类型:public class
  • 包:net.minecraft.client.particle
  • 源码路径:src/main/java/net/minecraft/client/particle/ShriekParticle.java
  • 起始行号:L16
  • 继承:SingleQuadParticle
  • 职责:

    TODO

字段/常量

  • MAGICAL_X_ROT

    • 类型: float
    • 修饰符: private static final
    • 源码定位: L17
    • 说明:

      TODO

  • delay

    • 类型: int
    • 修饰符: private
    • 源码定位: L18
    • 说明:

      TODO

内部类/嵌套类型

  • net.minecraft.client.particle.ShriekParticle.Provider
    • 类型: class
    • 修饰符: public static
    • 源码定位: L68
    • 说明:

      TODO

构造器

private ShriekParticle(ClientLevel level, double x, double y, double z, int delay, TextureAtlasSprite sprite) @ L20

  • 构造器名:ShriekParticle
  • 源码定位:L20
  • 修饰符:private

参数:

  • level: ClientLevel
  • x: double
  • y: double
  • z: double
  • delay: int
  • sprite: TextureAtlasSprite

说明:

TODO

方法

下面的方法块按源码顺序生成。

public float getQuadSize(float a) @ L31

  • 方法名:getQuadSize
  • 源码定位:L31
  • 返回类型:float
  • 修饰符:public

参数:

  • a: float

说明:

TODO

public void extract(QuadParticleRenderState particleTypeRenderState, Camera camera, float partialTickTime) @ L36

  • 方法名:extract
  • 源码定位:L36
  • 返回类型:void
  • 修饰符:public

参数:

  • particleTypeRenderState: QuadParticleRenderState
  • camera: Camera
  • partialTickTime: float

说明:

TODO

public int getLightCoords(float a) @ L48

  • 方法名:getLightCoords
  • 源码定位:L48
  • 返回类型:int
  • 修饰符:public

参数:

  • a: float

说明:

TODO

public SingleQuadParticle.Layer getLayer() @ L53

  • 方法名:getLayer
  • 源码定位:L53
  • 返回类型:SingleQuadParticle.Layer
  • 修饰符:public

参数:

说明:

TODO

public void tick() @ L58

  • 方法名:tick
  • 源码定位:L58
  • 返回类型:void
  • 修饰符:public

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class ShriekParticle extends SingleQuadParticle {
    private static final float MAGICAL_X_ROT = 1.0472F;
    private int delay;
 
    private ShriekParticle(ClientLevel level, double x, double y, double z, int delay, TextureAtlasSprite sprite) {
        super(level, x, y, z, 0.0, 0.0, 0.0, sprite);
        this.quadSize = 0.85F;
        this.delay = delay;
        this.lifetime = 30;
        this.gravity = 0.0F;
        this.xd = 0.0;
        this.yd = 0.1;
        this.zd = 0.0;
    }
 
    @Override
    public float getQuadSize(float a) {
        return this.quadSize * Mth.clamp((this.age + a) / this.lifetime * 0.75F, 0.0F, 1.0F);
    }
 
    @Override
    public void extract(QuadParticleRenderState particleTypeRenderState, Camera camera, float partialTickTime) {
        if (this.delay <= 0) {
            this.alpha = 1.0F - Mth.clamp((this.age + partialTickTime) / this.lifetime, 0.0F, 1.0F);
            Quaternionf rotation = new Quaternionf();
            rotation.rotationX(-1.0472F);
            this.extractRotatedQuad(particleTypeRenderState, camera, rotation, partialTickTime);
            rotation.rotationYXZ((float) -Math.PI, 1.0472F, 0.0F);
            this.extractRotatedQuad(particleTypeRenderState, camera, rotation, partialTickTime);
        }
    }
 
    @Override
    public int getLightCoords(float a) {
        return LightCoordsUtil.withBlock(super.getLightCoords(a), 15);
    }
 
    @Override
    public SingleQuadParticle.Layer getLayer() {
        return SingleQuadParticle.Layer.TRANSLUCENT;
    }
 
    @Override
    public void tick() {
        if (this.delay > 0) {
            this.delay--;
        } else {
            super.tick();
        }
    }
 
    @OnlyIn(Dist.CLIENT)
    public static class Provider implements ParticleProvider<ShriekParticleOption> {
        private final SpriteSet sprite;
 
        public Provider(SpriteSet sprite) {
            this.sprite = sprite;
        }
 
        public Particle createParticle(
            ShriekParticleOption options, ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, RandomSource random
        ) {
            ShriekParticle particle = new ShriekParticle(level, x, y, z, options.getDelay(), this.sprite.get(random));
            particle.setAlpha(1.0F);
            return particle;
        }
    }
}

引用的其他类