TrialSpawnerDetectionParticle.java

net.minecraft.client.particle.TrialSpawnerDetectionParticle

信息

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

    TODO

字段/常量

  • sprites

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

      TODO

  • BASE_LIFETIME

    • 类型: int
    • 修饰符: private static final
    • 源码定位: L14
    • 说明:

      TODO

内部类/嵌套类型

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

      TODO

构造器

protected TrialSpawnerDetectionParticle(ClientLevel level, double x, double y, double z, double xa, double ya, double za, float scale, SpriteSet sprites) @ L16

  • 构造器名:TrialSpawnerDetectionParticle
  • 源码定位:L16
  • 修饰符:protected

参数:

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

说明:

TODO

方法

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

public SingleQuadParticle.Layer getLayer() @ L35

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

参数:

说明:

TODO

public int getLightCoords(float a) @ L40

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

参数:

  • a: float

说明:

TODO

public SingleQuadParticle.FacingCameraMode getFacingCameraMode() @ L45

  • 方法名:getFacingCameraMode
  • 源码定位:L45
  • 返回类型:SingleQuadParticle.FacingCameraMode
  • 修饰符:public

参数:

说明:

TODO

public void tick() @ L50

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

参数:

说明:

TODO

public float getQuadSize(float a) @ L56

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

参数:

  • a: float

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class TrialSpawnerDetectionParticle extends SingleQuadParticle {
    private final SpriteSet sprites;
    private static final int BASE_LIFETIME = 8;
 
    protected TrialSpawnerDetectionParticle(ClientLevel level, double x, double y, double z, double xa, double ya, double za, float scale, SpriteSet sprites) {
        super(level, x, y, z, 0.0, 0.0, 0.0, sprites.first());
        this.sprites = sprites;
        this.friction = 0.96F;
        this.gravity = -0.1F;
        this.speedUpWhenYMotionIsBlocked = true;
        this.xd *= 0.0;
        this.yd *= 0.9;
        this.zd *= 0.0;
        this.xd += xa;
        this.yd += ya;
        this.zd += za;
        this.quadSize *= 0.75F * scale;
        this.lifetime = (int)(8.0F / Mth.randomBetween(this.random, 0.5F, 1.0F) * scale);
        this.lifetime = Math.max(this.lifetime, 1);
        this.setSpriteFromAge(sprites);
        this.hasPhysics = true;
    }
 
    @Override
    public SingleQuadParticle.Layer getLayer() {
        return SingleQuadParticle.Layer.OPAQUE;
    }
 
    @Override
    public int getLightCoords(float a) {
        return LightCoordsUtil.withBlock(super.getLightCoords(a), 15);
    }
 
    @Override
    public SingleQuadParticle.FacingCameraMode getFacingCameraMode() {
        return SingleQuadParticle.FacingCameraMode.LOOKAT_Y;
    }
 
    @Override
    public void tick() {
        super.tick();
        this.setSpriteFromAge(this.sprites);
    }
 
    @Override
    public float getQuadSize(float a) {
        return this.quadSize * Mth.clamp((this.age + a) / this.lifetime * 32.0F, 0.0F, 1.0F);
    }
 
    @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 TrialSpawnerDetectionParticle(level, x, y, z, xAux, yAux, zAux, 1.5F, this.sprites);
        }
    }
}

引用的其他类

  • ClientLevel

    • 引用位置: 参数
  • SingleQuadParticle

    • 引用位置: 继承/返回值
  • SpriteSet

    • 引用位置: 参数/字段
  • LightCoordsUtil

    • 引用位置: 方法调用
    • 关联成员: LightCoordsUtil.withBlock()
  • Mth

    • 引用位置: 方法调用
    • 关联成员: Mth.clamp(), Mth.randomBetween()