HeartParticle.java

net.minecraft.client.particle.HeartParticle

信息

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

    TODO

字段/常量

内部类/嵌套类型

  • net.minecraft.client.particle.HeartParticle.AngryVillagerProvider

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

      TODO

  • net.minecraft.client.particle.HeartParticle.Provider

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

      TODO

构造器

private HeartParticle(ClientLevel level, double x, double y, double z, TextureAtlasSprite sprite) @ L13

  • 构造器名:HeartParticle
  • 源码定位:L13
  • 修饰符:private

参数:

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

说明:

TODO

方法

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

public SingleQuadParticle.Layer getLayer() @ L26

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

参数:

说明:

TODO

public float getQuadSize(float a) @ L31

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

参数:

  • a: float

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class HeartParticle extends SingleQuadParticle {
    private HeartParticle(ClientLevel level, double x, double y, double z, TextureAtlasSprite sprite) {
        super(level, x, y, z, 0.0, 0.0, 0.0, sprite);
        this.speedUpWhenYMotionIsBlocked = true;
        this.friction = 0.86F;
        this.xd *= 0.01F;
        this.yd *= 0.01F;
        this.zd *= 0.01F;
        this.yd += 0.1;
        this.quadSize *= 1.5F;
        this.lifetime = 16;
        this.hasPhysics = false;
    }
 
    @Override
    public SingleQuadParticle.Layer getLayer() {
        return SingleQuadParticle.Layer.OPAQUE;
    }
 
    @Override
    public float getQuadSize(float a) {
        return this.quadSize * Mth.clamp((this.age + a) / this.lifetime * 32.0F, 0.0F, 1.0F);
    }
 
    @OnlyIn(Dist.CLIENT)
    public static class AngryVillagerProvider implements ParticleProvider<SimpleParticleType> {
        private final SpriteSet sprite;
 
        public AngryVillagerProvider(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
        ) {
            HeartParticle particle = new HeartParticle(level, x, y + 0.5, z, 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 HeartParticle(level, x, y, z, this.sprite.get(random));
        }
    }
}

引用的其他类