ReversePortalParticle.java

net.minecraft.client.particle.ReversePortalParticle

信息

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

    TODO

字段/常量

内部类/嵌套类型

  • net.minecraft.client.particle.ReversePortalParticle.ReversePortalProvider
    • 类型: class
    • 修饰符: public static
    • 源码定位: L40
    • 说明:

      TODO

构造器

private ReversePortalParticle(ClientLevel level, double x, double y, double z, double xd, double yd, double zd, TextureAtlasSprite sprite) @ L12

  • 构造器名:ReversePortalParticle
  • 源码定位:L12
  • 修饰符:private

参数:

  • level: ClientLevel
  • x: double
  • y: double
  • z: double
  • xd: double
  • yd: double
  • zd: double
  • sprite: TextureAtlasSprite

说明:

TODO

方法

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

public float getQuadSize(float a) @ L18

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

参数:

  • a: float

说明:

TODO

public void tick() @ L24

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

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class ReversePortalParticle extends PortalParticle {
    private ReversePortalParticle(ClientLevel level, double x, double y, double z, double xd, double yd, double zd, TextureAtlasSprite sprite) {
        super(level, x, y, z, xd, yd, zd, sprite);
        this.quadSize *= 1.5F;
        this.lifetime = (int)(this.random.nextFloat() * 2.0F) + 60;
    }
 
    @Override
    public float getQuadSize(float a) {
        float s = 1.0F - (this.age + a) / (this.lifetime * 1.5F);
        return this.quadSize * s;
    }
 
    @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 speedMultiplier = (float)this.age / this.lifetime;
            this.x = this.x + this.xd * speedMultiplier;
            this.y = this.y + this.yd * speedMultiplier;
            this.z = this.z + this.zd * speedMultiplier;
        }
    }
 
    @OnlyIn(Dist.CLIENT)
    public static class ReversePortalProvider implements ParticleProvider<SimpleParticleType> {
        private final SpriteSet sprite;
 
        public ReversePortalProvider(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 ReversePortalParticle(level, x, y, z, xAux, yAux, zAux, this.sprite.get(random));
        }
    }
}

引用的其他类