NoteParticle.java

net.minecraft.client.particle.NoteParticle

信息

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

    TODO

字段/常量

内部类/嵌套类型

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

      TODO

构造器

private NoteParticle(ClientLevel level, double x, double y, double z, double color, TextureAtlasSprite sprite) @ L13

  • 构造器名:NoteParticle
  • 源码定位:L13
  • 修饰符:private

参数:

  • level: ClientLevel
  • x: double
  • y: double
  • z: double
  • color: double
  • sprite: TextureAtlasSprite

说明:

TODO

方法

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

public SingleQuadParticle.Layer getLayer() @ L28

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

参数:

说明:

TODO

public float getQuadSize(float a) @ L33

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

参数:

  • a: float

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class NoteParticle extends SingleQuadParticle {
    private NoteParticle(ClientLevel level, double x, double y, double z, double color, TextureAtlasSprite sprite) {
        super(level, x, y, z, 0.0, 0.0, 0.0, sprite);
        this.friction = 0.66F;
        this.speedUpWhenYMotionIsBlocked = true;
        this.xd *= 0.01F;
        this.yd *= 0.01F;
        this.zd *= 0.01F;
        this.yd += 0.2;
        this.rCol = Math.max(0.0F, Mth.sin(((float)color + 0.0F) * (float) (Math.PI * 2)) * 0.65F + 0.35F);
        this.gCol = Math.max(0.0F, Mth.sin(((float)color + 0.33333334F) * (float) (Math.PI * 2)) * 0.65F + 0.35F);
        this.bCol = Math.max(0.0F, Mth.sin(((float)color + 0.6666667F) * (float) (Math.PI * 2)) * 0.65F + 0.35F);
        this.quadSize *= 1.5F;
        this.lifetime = 6;
    }
 
    @Override
    public SingleQuadParticle.Layer getLayer() {
        return SingleQuadParticle.Layer.OPAQUE;
    }
 
    @Override
    public float getQuadSize(float a) {
        return this.quadSize * Mth.clamp((this.age + a) / this.lifetime * 32.0F, 0.0F, 1.0F);
    }
 
    @OnlyIn(Dist.CLIENT)
    public static class Provider implements ParticleProvider<SimpleParticleType> {
        private final SpriteSet sprite;
 
        public Provider(SpriteSet sprite) {
            this.sprite = sprite;
        }
 
        public Particle createParticle(
            SimpleParticleType options, ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, RandomSource random
        ) {
            return new NoteParticle(level, x, y, z, xAux, this.sprite.get(random));
        }
    }
}

引用的其他类