DustParticleBase.java

net.minecraft.client.particle.DustParticleBase

信息

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

    TODO

字段/常量

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

      TODO

内部类/嵌套类型

构造器

protected DustParticleBase(ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, T options, SpriteSet sprites) @ L13

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

参数:

  • level: ClientLevel
  • x: double
  • y: double
  • z: double
  • xAux: double
  • yAux: double
  • zAux: double
  • options: T
  • sprites: SpriteSet

说明:

TODO

方法

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

protected float randomizeColor(float color, float baseFactor) @ L27

  • 方法名:randomizeColor
  • 源码定位:L27
  • 返回类型:float
  • 修饰符:protected

参数:

  • color: float
  • baseFactor: float

说明:

TODO

public SingleQuadParticle.Layer getLayer() @ L31

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

参数:

说明:

TODO

public float getQuadSize(float a) @ L36

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

参数:

  • a: float

说明:

TODO

public void tick() @ L41

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

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class DustParticleBase<T extends ScalableParticleOptionsBase> extends SingleQuadParticle {
    private final SpriteSet sprites;
 
    protected DustParticleBase(ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, T options, SpriteSet sprites) {
        super(level, x, y, z, xAux, yAux, zAux, sprites.first());
        this.friction = 0.96F;
        this.speedUpWhenYMotionIsBlocked = true;
        this.sprites = sprites;
        this.xd *= 0.1F;
        this.yd *= 0.1F;
        this.zd *= 0.1F;
        this.quadSize = this.quadSize * (0.75F * options.getScale());
        int baseLifetime = (int)(8.0 / (this.random.nextDouble() * 0.8 + 0.2));
        this.lifetime = (int)Math.max(baseLifetime * options.getScale(), 1.0F);
        this.setSpriteFromAge(sprites);
    }
 
    protected float randomizeColor(float color, float baseFactor) {
        return (this.random.nextFloat() * 0.2F + 0.8F) * color * baseFactor;
    }
 
    @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);
    }
 
    @Override
    public void tick() {
        super.tick();
        this.setSpriteFromAge(this.sprites);
    }
}

引用的其他类