ExplodeParticle.java

net.minecraft.client.particle.ExplodeParticle

信息

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

    TODO

字段/常量

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

      TODO

内部类/嵌套类型

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

      TODO

构造器

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

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

参数:

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

说明:

TODO

方法

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

public SingleQuadParticle.Layer getLayer() @ L30

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

参数:

说明:

TODO

public void tick() @ L35

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

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class ExplodeParticle extends SingleQuadParticle {
    private final SpriteSet sprites;
 
    protected ExplodeParticle(ClientLevel level, double x, double y, double z, double xa, double ya, double za, SpriteSet sprites) {
        super(level, x, y, z, sprites.first());
        this.gravity = -0.1F;
        this.friction = 0.9F;
        this.sprites = sprites;
        this.xd = xa + (this.random.nextFloat() * 2.0F - 1.0F) * 0.05F;
        this.yd = ya + (this.random.nextFloat() * 2.0F - 1.0F) * 0.05F;
        this.zd = za + (this.random.nextFloat() * 2.0F - 1.0F) * 0.05F;
        float col = this.random.nextFloat() * 0.3F + 0.7F;
        this.rCol = col;
        this.gCol = col;
        this.bCol = col;
        this.quadSize = 0.1F * (this.random.nextFloat() * this.random.nextFloat() * 6.0F + 1.0F);
        this.lifetime = (int)(16.0 / (this.random.nextFloat() * 0.8 + 0.2)) + 2;
        this.setSpriteFromAge(sprites);
    }
 
    @Override
    public SingleQuadParticle.Layer getLayer() {
        return SingleQuadParticle.Layer.OPAQUE;
    }
 
    @Override
    public void tick() {
        super.tick();
        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 ExplodeParticle(level, x, y, z, xAux, yAux, zAux, this.sprites);
        }
    }
}

引用的其他类