WaterCurrentDownParticle.java

net.minecraft.client.particle.WaterCurrentDownParticle

信息

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

    TODO

字段/常量

  • angle
    • 类型: float
    • 修饰符: private
    • 源码定位: L15
    • 说明:

      TODO

内部类/嵌套类型

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

      TODO

构造器

private WaterCurrentDownParticle(ClientLevel level, double x, double y, double z, TextureAtlasSprite sprite) @ L17

  • 构造器名:WaterCurrentDownParticle
  • 源码定位:L17
  • 修饰符:private

参数:

  • level: ClientLevel
  • x: double
  • y: double
  • z: double
  • sprite: TextureAtlasSprite

说明:

TODO

方法

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

public SingleQuadParticle.Layer getLayer() @ L29

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

参数:

说明:

TODO

public void tick() @ L34

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

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class WaterCurrentDownParticle extends SingleQuadParticle {
    private float angle;
 
    private WaterCurrentDownParticle(ClientLevel level, double x, double y, double z, TextureAtlasSprite sprite) {
        super(level, x, y, z, sprite);
        this.lifetime = (int)(this.random.nextFloat() * 60.0F) + 30;
        this.hasPhysics = false;
        this.xd = 0.0;
        this.yd = -0.05;
        this.zd = 0.0;
        this.setSize(0.02F, 0.02F);
        this.quadSize = this.quadSize * (this.random.nextFloat() * 0.6F + 0.2F);
        this.gravity = 0.002F;
    }
 
    @Override
    public SingleQuadParticle.Layer getLayer() {
        return SingleQuadParticle.Layer.OPAQUE;
    }
 
    @Override
    public void tick() {
        this.xo = this.x;
        this.yo = this.y;
        this.zo = this.z;
        if (this.age++ >= this.lifetime) {
            this.remove();
        } else {
            float radius = 0.6F;
            this.xd = this.xd + 0.6F * Mth.cos(this.angle);
            this.zd = this.zd + 0.6F * Mth.sin(this.angle);
            this.xd *= 0.07;
            this.zd *= 0.07;
            this.move(this.xd, this.yd, this.zd);
            if (!this.level.getFluidState(BlockPos.containing(this.x, this.y, this.z)).is(FluidTags.WATER) || this.onGround) {
                this.remove();
            }
 
            this.angle += 0.08F;
        }
    }
 
    @OnlyIn(Dist.CLIENT)
    public static class Provider implements ParticleProvider<SimpleParticleType> {
        private final SpriteSet sprite;
 
        public Provider(SpriteSet sprite) {
            this.sprite = sprite;
        }
 
        public Particle createParticle(
            SimpleParticleType options, ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, RandomSource random
        ) {
            return new WaterCurrentDownParticle(level, x, y, z, this.sprite.get(random));
        }
    }
}

引用的其他类