BaseAshSmokeParticle.java

net.minecraft.client.particle.BaseAshSmokeParticle

信息

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

    TODO

字段/常量

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

      TODO

内部类/嵌套类型

构造器

protected BaseAshSmokeParticle(ClientLevel level, double x, double y, double z, float dirX, float dirY, float dirZ, double xa, double ya, double za, float scale, SpriteSet sprites, float colorRandom, int maxLifetime, float gravity, boolean hasPhysics) @ L12

  • 构造器名:BaseAshSmokeParticle
  • 源码定位:L12
  • 修饰符:protected

参数:

  • level: ClientLevel
  • x: double
  • y: double
  • z: double
  • dirX: float
  • dirY: float
  • dirZ: float
  • xa: double
  • ya: double
  • za: double
  • scale: float
  • sprites: SpriteSet
  • colorRandom: float
  • maxLifetime: int
  • gravity: float
  • hasPhysics: boolean

说明:

TODO

方法

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

public SingleQuadParticle.Layer getLayer() @ L52

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

参数:

说明:

TODO

public float getQuadSize(float a) @ L57

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

参数:

  • a: float

说明:

TODO

public void tick() @ L62

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

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public abstract class BaseAshSmokeParticle extends SingleQuadParticle {
    private final SpriteSet sprites;
 
    protected BaseAshSmokeParticle(
        ClientLevel level,
        double x,
        double y,
        double z,
        float dirX,
        float dirY,
        float dirZ,
        double xa,
        double ya,
        double za,
        float scale,
        SpriteSet sprites,
        float colorRandom,
        int maxLifetime,
        float gravity,
        boolean hasPhysics
    ) {
        super(level, x, y, z, 0.0, 0.0, 0.0, sprites.first());
        this.friction = 0.96F;
        this.gravity = gravity;
        this.speedUpWhenYMotionIsBlocked = true;
        this.sprites = sprites;
        this.xd *= dirX;
        this.yd *= dirY;
        this.zd *= dirZ;
        this.xd += xa;
        this.yd += ya;
        this.zd += za;
        float col = this.random.nextFloat() * colorRandom;
        this.rCol = col;
        this.gCol = col;
        this.bCol = col;
        this.quadSize *= 0.75F * scale;
        this.lifetime = (int)(maxLifetime / (this.random.nextFloat() * 0.8 + 0.2) * scale);
        this.lifetime = Math.max(this.lifetime, 1);
        this.setSpriteFromAge(sprites);
        this.hasPhysics = hasPhysics;
    }
 
    @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);
    }
}

引用的其他类