GustSeedParticle.java

net.minecraft.client.particle.GustSeedParticle

信息

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

    TODO

字段/常量

  • scale

    • 类型: double
    • 修饰符: private final
    • 源码定位: L12
    • 说明:

      TODO

  • tickDelayInBetween

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

      TODO

内部类/嵌套类型

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

      TODO

构造器

private GustSeedParticle(ClientLevel level, double x, double y, double z, double scale, int lifetime, int tickDelayInBetween) @ L15

  • 构造器名:GustSeedParticle
  • 源码定位:L15
  • 修饰符:private

参数:

  • level: ClientLevel
  • x: double
  • y: double
  • z: double
  • scale: double
  • lifetime: int
  • tickDelayInBetween: int

说明:

TODO

方法

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

public void tick() @ L22

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

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class GustSeedParticle extends NoRenderParticle {
    private final double scale;
    private final int tickDelayInBetween;
 
    private GustSeedParticle(ClientLevel level, double x, double y, double z, double scale, int lifetime, int tickDelayInBetween) {
        super(level, x, y, z, 0.0, 0.0, 0.0);
        this.scale = scale;
        this.lifetime = lifetime;
        this.tickDelayInBetween = tickDelayInBetween;
    }
 
    @Override
    public void tick() {
        if (this.age % (this.tickDelayInBetween + 1) == 0) {
            for (int i = 0; i < 3; i++) {
                double x = this.x + (this.random.nextDouble() - this.random.nextDouble()) * this.scale;
                double y = this.y + (this.random.nextDouble() - this.random.nextDouble()) * this.scale;
                double z = this.z + (this.random.nextDouble() - this.random.nextDouble()) * this.scale;
                this.level.addParticle(ParticleTypes.GUST, x, y, z, (float)this.age / this.lifetime, 0.0, 0.0);
            }
        }
 
        if (this.age++ == this.lifetime) {
            this.remove();
        }
    }
 
    @OnlyIn(Dist.CLIENT)
    public static class Provider implements ParticleProvider<SimpleParticleType> {
        private final double scale;
        private final int lifetime;
        private final int tickDelayInBetween;
 
        public Provider(double scale, int lifetime, int tickDelayInBetween) {
            this.scale = scale;
            this.lifetime = lifetime;
            this.tickDelayInBetween = tickDelayInBetween;
        }
 
        public Particle createParticle(
            SimpleParticleType options, ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, RandomSource random
        ) {
            return new GustSeedParticle(level, x, y, z, this.scale, this.lifetime, this.tickDelayInBetween);
        }
    }
}

引用的其他类