SuspendedTownParticle.java

net.minecraft.client.particle.SuspendedTownParticle

信息

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

    TODO

字段/常量

内部类/嵌套类型

  • net.minecraft.client.particle.SuspendedTownParticle.ComposterFillProvider

    • 类型: class
    • 修饰符: public static
    • 源码定位: L53
    • 说明:

      TODO

  • net.minecraft.client.particle.SuspendedTownParticle.DolphinSpeedProvider

    • 类型: class
    • 修饰符: public static
    • 源码定位: L71
    • 说明:

      TODO

  • net.minecraft.client.particle.SuspendedTownParticle.EggCrackProvider

    • 类型: class
    • 修饰符: public static
    • 源码定位: L90
    • 说明:

      TODO

  • net.minecraft.client.particle.SuspendedTownParticle.HappyVillagerProvider

    • 类型: class
    • 修饰符: public static
    • 源码定位: L107
    • 说明:

      TODO

  • net.minecraft.client.particle.SuspendedTownParticle.Provider

    • 类型: class
    • 修饰符: public static
    • 源码定位: L124
    • 说明:

      TODO

构造器

private SuspendedTownParticle(ClientLevel level, double x, double y, double z, double xa, double ya, double za, TextureAtlasSprite sprite) @ L12

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

参数:

  • level: ClientLevel
  • x: double
  • y: double
  • z: double
  • xa: double
  • ya: double
  • za: double
  • sprite: TextureAtlasSprite

说明:

TODO

方法

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

public SingleQuadParticle.Layer getLayer() @ L26

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

参数:

说明:

TODO

public void move(double xa, double ya, double za) @ L31

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

参数:

  • xa: double
  • ya: double
  • za: double

说明:

TODO

public void tick() @ L37

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

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class SuspendedTownParticle extends SingleQuadParticle {
    private SuspendedTownParticle(ClientLevel level, double x, double y, double z, double xa, double ya, double za, TextureAtlasSprite sprite) {
        super(level, x, y, z, xa, ya, za, sprite);
        float br = this.random.nextFloat() * 0.1F + 0.2F;
        this.rCol = br;
        this.gCol = br;
        this.bCol = br;
        this.setSize(0.02F, 0.02F);
        this.quadSize = this.quadSize * (this.random.nextFloat() * 0.6F + 0.5F);
        this.xd *= 0.02F;
        this.yd *= 0.02F;
        this.zd *= 0.02F;
        this.lifetime = (int)(20.0 / (this.random.nextFloat() * 0.8 + 0.2));
    }
 
    @Override
    public SingleQuadParticle.Layer getLayer() {
        return SingleQuadParticle.Layer.OPAQUE;
    }
 
    @Override
    public void move(double xa, double ya, double za) {
        this.setBoundingBox(this.getBoundingBox().move(xa, ya, za));
        this.setLocationFromBoundingbox();
    }
 
    @Override
    public void tick() {
        this.xo = this.x;
        this.yo = this.y;
        this.zo = this.z;
        if (this.lifetime-- <= 0) {
            this.remove();
        } else {
            this.move(this.xd, this.yd, this.zd);
            this.xd *= 0.99;
            this.yd *= 0.99;
            this.zd *= 0.99;
        }
    }
 
    @OnlyIn(Dist.CLIENT)
    public static class ComposterFillProvider implements ParticleProvider<SimpleParticleType> {
        private final SpriteSet sprite;
 
        public ComposterFillProvider(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
        ) {
            SuspendedTownParticle particle = new SuspendedTownParticle(level, x, y, z, xAux, yAux, zAux, this.sprite.get(random));
            particle.setColor(1.0F, 1.0F, 1.0F);
            particle.setLifetime(3 + level.getRandom().nextInt(5));
            return particle;
        }
    }
 
    @OnlyIn(Dist.CLIENT)
    public static class DolphinSpeedProvider implements ParticleProvider<SimpleParticleType> {
        private final SpriteSet sprite;
 
        public DolphinSpeedProvider(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
        ) {
            SuspendedTownParticle particle = new SuspendedTownParticle(level, x, y, z, xAux, yAux, zAux, this.sprite.get(random));
            particle.setColor(0.3F, 0.5F, 1.0F);
            particle.setAlpha(1.0F - random.nextFloat() * 0.7F);
            particle.setLifetime(particle.getLifetime() / 2);
            return particle;
        }
    }
 
    @OnlyIn(Dist.CLIENT)
    public static class EggCrackProvider implements ParticleProvider<SimpleParticleType> {
        private final SpriteSet sprite;
 
        public EggCrackProvider(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
        ) {
            SuspendedTownParticle particle = new SuspendedTownParticle(level, x, y, z, xAux, yAux, zAux, this.sprite.get(random));
            particle.setColor(1.0F, 1.0F, 1.0F);
            return particle;
        }
    }
 
    @OnlyIn(Dist.CLIENT)
    public static class HappyVillagerProvider implements ParticleProvider<SimpleParticleType> {
        private final SpriteSet sprite;
 
        public HappyVillagerProvider(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
        ) {
            SuspendedTownParticle particle = new SuspendedTownParticle(level, x, y, z, xAux, yAux, zAux, this.sprite.get(random));
            particle.setColor(1.0F, 1.0F, 1.0F);
            return particle;
        }
    }
 
    @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 SuspendedTownParticle(level, x, y, z, xAux, yAux, zAux, this.sprite.get(random));
        }
    }
}

引用的其他类