WakeParticle.java

net.minecraft.client.particle.WakeParticle

信息

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

    TODO

字段/常量

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

      TODO

内部类/嵌套类型

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

      TODO

构造器

private WakeParticle(ClientLevel level, double x, double y, double z, double xa, double ya, double za, SpriteSet sprites) @ L13

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

参数:

  • level: ClientLevel
  • x: double
  • y: double
  • z: double
  • xa: double
  • ya: double
  • za: double
  • sprites: SpriteSet

说明:

TODO

方法

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

public SingleQuadParticle.Layer getLayer() @ L28

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

参数:

说明:

TODO

public void tick() @ L33

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

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class WakeParticle extends SingleQuadParticle {
    private final SpriteSet sprites;
 
    private WakeParticle(ClientLevel level, double x, double y, double z, double xa, double ya, double za, SpriteSet sprites) {
        super(level, x, y, z, 0.0, 0.0, 0.0, sprites.first());
        this.sprites = sprites;
        this.xd *= 0.3F;
        this.yd = this.random.nextFloat() * 0.2F + 0.1F;
        this.zd *= 0.3F;
        this.setSize(0.01F, 0.01F);
        this.lifetime = (int)(8.0 / (this.random.nextFloat() * 0.8 + 0.2));
        this.setSpriteFromAge(sprites);
        this.gravity = 0.0F;
        this.xd = xa;
        this.yd = ya;
        this.zd = za;
    }
 
    @Override
    public SingleQuadParticle.Layer getLayer() {
        return SingleQuadParticle.Layer.OPAQUE;
    }
 
    @Override
    public void tick() {
        this.xo = this.x;
        this.yo = this.y;
        this.zo = this.z;
        int life = 60 - this.lifetime;
        if (this.lifetime-- <= 0) {
            this.remove();
        } else {
            this.yd = this.yd - this.gravity;
            this.move(this.xd, this.yd, this.zd);
            this.xd *= 0.98F;
            this.yd *= 0.98F;
            this.zd *= 0.98F;
            float size = life * 0.001F;
            this.setSize(size, size);
            this.setSprite(this.sprites.get(life % 4, 4));
        }
    }
 
    @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 WakeParticle(level, x, y, z, xAux, yAux, zAux, this.sprites);
        }
    }
}

引用的其他类