GlowParticle.java

net.minecraft.client.particle.GlowParticle

信息

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

    TODO

字段/常量

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

      TODO

内部类/嵌套类型

  • net.minecraft.client.particle.GlowParticle.ElectricSparkProvider

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

      TODO

  • net.minecraft.client.particle.GlowParticle.GlowSquidProvider

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

      TODO

  • net.minecraft.client.particle.GlowParticle.ScrapeProvider

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

      TODO

  • net.minecraft.client.particle.GlowParticle.WaxOffProvider

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

      TODO

  • net.minecraft.client.particle.GlowParticle.WaxOnProvider

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

      TODO

构造器

private GlowParticle(ClientLevel level, double x, double y, double z, double xa, double ya, double za, SpriteSet sprites) @ L14

  • 构造器名:GlowParticle
  • 源码定位:L14
  • 修饰符:private

参数:

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

说明:

TODO

方法

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

public SingleQuadParticle.Layer getLayer() @ L24

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

参数:

说明:

TODO

public int getLightCoords(float a) @ L29

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

参数:

  • a: float

说明:

TODO

public void tick() @ L34

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

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class GlowParticle extends SingleQuadParticle {
    private final SpriteSet sprites;
 
    private GlowParticle(ClientLevel level, double x, double y, double z, double xa, double ya, double za, SpriteSet sprites) {
        super(level, x, y, z, xa, ya, za, sprites.first());
        this.friction = 0.96F;
        this.speedUpWhenYMotionIsBlocked = true;
        this.sprites = sprites;
        this.quadSize *= 0.75F;
        this.hasPhysics = false;
        this.setSpriteFromAge(sprites);
    }
 
    @Override
    public SingleQuadParticle.Layer getLayer() {
        return SingleQuadParticle.Layer.OPAQUE;
    }
 
    @Override
    public int getLightCoords(float a) {
        return LightCoordsUtil.addSmoothBlockEmission(super.getLightCoords(a), (this.age + a) / this.lifetime);
    }
 
    @Override
    public void tick() {
        super.tick();
        this.setSpriteFromAge(this.sprites);
    }
 
    @OnlyIn(Dist.CLIENT)
    public static class ElectricSparkProvider implements ParticleProvider<SimpleParticleType> {
        private static final double SPEED_FACTOR = 0.25;
        private final SpriteSet sprite;
 
        public ElectricSparkProvider(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
        ) {
            GlowParticle glowParticle = new GlowParticle(level, x, y, z, 0.0, 0.0, 0.0, this.sprite);
            glowParticle.setColor(1.0F, 0.9F, 1.0F);
            glowParticle.setParticleSpeed(xAux * 0.25, yAux * 0.25, zAux * 0.25);
            int minLifespan = 2;
            int maxLifespan = 4;
            glowParticle.setLifetime(random.nextInt(2) + 2);
            return glowParticle;
        }
    }
 
    @OnlyIn(Dist.CLIENT)
    public static class GlowSquidProvider implements ParticleProvider<SimpleParticleType> {
        private final SpriteSet sprite;
 
        public GlowSquidProvider(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
        ) {
            GlowParticle glowParticle = new GlowParticle(level, x, y, z, 0.5 - random.nextDouble(), yAux, 0.5 - random.nextDouble(), this.sprite);
            if (random.nextBoolean()) {
                glowParticle.setColor(0.6F, 1.0F, 0.8F);
            } else {
                glowParticle.setColor(0.08F, 0.4F, 0.4F);
            }
 
            glowParticle.yd *= 0.2F;
            if (xAux == 0.0 && zAux == 0.0) {
                glowParticle.xd *= 0.1F;
                glowParticle.zd *= 0.1F;
            }
 
            glowParticle.setLifetime((int)(8.0 / (random.nextDouble() * 0.8 + 0.2)));
            return glowParticle;
        }
    }
 
    @OnlyIn(Dist.CLIENT)
    public static class ScrapeProvider implements ParticleProvider<SimpleParticleType> {
        private static final double SPEED_FACTOR = 0.01;
        private final SpriteSet sprite;
 
        public ScrapeProvider(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
        ) {
            GlowParticle glowParticle = new GlowParticle(level, x, y, z, 0.0, 0.0, 0.0, this.sprite);
            if (random.nextBoolean()) {
                glowParticle.setColor(0.29F, 0.58F, 0.51F);
            } else {
                glowParticle.setColor(0.43F, 0.77F, 0.62F);
            }
 
            glowParticle.setParticleSpeed(xAux * 0.01, yAux * 0.01, zAux * 0.01);
            int minLifespan = 10;
            int maxLifespan = 40;
            glowParticle.setLifetime(random.nextInt(30) + 10);
            return glowParticle;
        }
    }
 
    @OnlyIn(Dist.CLIENT)
    public static class WaxOffProvider implements ParticleProvider<SimpleParticleType> {
        private static final double SPEED_FACTOR = 0.01;
        private final SpriteSet sprite;
 
        public WaxOffProvider(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
        ) {
            GlowParticle glowParticle = new GlowParticle(level, x, y, z, 0.0, 0.0, 0.0, this.sprite);
            glowParticle.setColor(1.0F, 0.9F, 1.0F);
            glowParticle.setParticleSpeed(xAux * 0.01 / 2.0, yAux * 0.01, zAux * 0.01 / 2.0);
            int minLifespan = 10;
            int maxLifespan = 40;
            glowParticle.setLifetime(random.nextInt(30) + 10);
            return glowParticle;
        }
    }
 
    @OnlyIn(Dist.CLIENT)
    public static class WaxOnProvider implements ParticleProvider<SimpleParticleType> {
        private static final double SPEED_FACTOR = 0.01;
        private final SpriteSet sprite;
 
        public WaxOnProvider(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
        ) {
            GlowParticle glowParticle = new GlowParticle(level, x, y, z, 0.0, 0.0, 0.0, this.sprite);
            glowParticle.setColor(0.91F, 0.55F, 0.08F);
            glowParticle.setParticleSpeed(xAux * 0.01 / 2.0, yAux * 0.01, zAux * 0.01 / 2.0);
            int minLifespan = 10;
            int maxLifespan = 40;
            glowParticle.setLifetime(random.nextInt(30) + 10);
            return glowParticle;
        }
    }
}

引用的其他类