GustParticle.java

net.minecraft.client.particle.GustParticle

信息

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

    TODO

字段/常量

  • sprites
    • 类型: SpriteSet
    • 修饰符: private final
    • 源码定位: L11
    • 说明:

      TODO

内部类/嵌套类型

  • net.minecraft.client.particle.GustParticle.Provider

    • 类型: class
    • 修饰符: public static
    • 源码定位: L42
    • 说明:

      TODO

  • net.minecraft.client.particle.GustParticle.SmallProvider

    • 类型: class
    • 修饰符: public static
    • 源码定位: L57
    • 说明:

      TODO

构造器

protected GustParticle(ClientLevel level, double x, double y, double z, SpriteSet sprites) @ L13

  • 构造器名:GustParticle
  • 源码定位:L13
  • 修饰符:protected

参数:

  • level: ClientLevel
  • x: double
  • y: double
  • z: double
  • sprites: SpriteSet

说明:

TODO

方法

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

public SingleQuadParticle.Layer getLayer() @ L22

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

参数:

说明:

TODO

public int getLightCoords(float a) @ L27

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

参数:

  • a: float

说明:

TODO

public void tick() @ L32

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

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class GustParticle extends SingleQuadParticle {
    private final SpriteSet sprites;
 
    protected GustParticle(ClientLevel level, double x, double y, double z, SpriteSet sprites) {
        super(level, x, y, z, sprites.first());
        this.sprites = sprites;
        this.setSpriteFromAge(sprites);
        this.lifetime = 12 + this.random.nextInt(4);
        this.quadSize = 1.0F;
        this.setSize(1.0F, 1.0F);
    }
 
    @Override
    public SingleQuadParticle.Layer getLayer() {
        return SingleQuadParticle.Layer.OPAQUE;
    }
 
    @Override
    public int getLightCoords(float a) {
        return 15728880;
    }
 
    @Override
    public void tick() {
        if (this.age++ >= this.lifetime) {
            this.remove();
        } else {
            this.setSpriteFromAge(this.sprites);
        }
    }
 
    @OnlyIn(Dist.CLIENT)
    public static class Provider implements ParticleProvider<SimpleParticleType> {
        private final SpriteSet sprites;
 
        public Provider(SpriteSet sprites) {
            this.sprites = sprites;
        }
 
        public Particle createParticle(
            SimpleParticleType options, ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, RandomSource random
        ) {
            return new GustParticle(level, x, y, z, this.sprites);
        }
    }
 
    @OnlyIn(Dist.CLIENT)
    public static class SmallProvider implements ParticleProvider<SimpleParticleType> {
        private final SpriteSet sprites;
 
        public SmallProvider(SpriteSet sprites) {
            this.sprites = sprites;
        }
 
        public Particle createParticle(
            SimpleParticleType options, ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, RandomSource random
        ) {
            Particle particle = new GustParticle(level, x, y, z, this.sprites);
            particle.scale(0.15F);
            return particle;
        }
    }
}

引用的其他类