CritParticle.java
net.minecraft.client.particle.CritParticle
信息
- 全限定名:net.minecraft.client.particle.CritParticle
- 类型:public class
- 包:net.minecraft.client.particle
- 源码路径:src/main/java/net/minecraft/client/particle/CritParticle.java
- 起始行号:L12
- 继承:SingleQuadParticle
- 职责:
TODO
字段/常量
- 无
内部类/嵌套类型
-
net.minecraft.client.particle.CritParticle.DamageIndicatorProvider- 类型:
class - 修饰符:
public static - 源码定位:
L51 - 说明:
TODO
- 类型:
-
net.minecraft.client.particle.CritParticle.MagicProvider- 类型:
class - 修饰符:
public static - 源码定位:
L68 - 说明:
TODO
- 类型:
-
net.minecraft.client.particle.CritParticle.Provider- 类型:
class - 修饰符:
public static - 源码定位:
L86 - 说明:
TODO
- 类型:
构造器
private CritParticle(ClientLevel level, double x, double y, double z, double xa, double ya, double za, TextureAtlasSprite sprite) @ L13
- 构造器名:CritParticle
- 源码定位:L13
- 修饰符:private
参数:
- level: ClientLevel
- x: double
- y: double
- z: double
- xa: double
- ya: double
- za: double
- sprite: TextureAtlasSprite
说明:
TODO
方法
下面的方法块按源码顺序生成。
public float getQuadSize(float a) @ L33
- 方法名:getQuadSize
- 源码定位:L33
- 返回类型:float
- 修饰符:public
参数:
- a: float
说明:
TODO
public void tick() @ L38
- 方法名:tick
- 源码定位:L38
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public SingleQuadParticle.Layer getLayer() @ L45
- 方法名:getLayer
- 源码定位:L45
- 返回类型:SingleQuadParticle.Layer
- 修饰符:public
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class CritParticle extends SingleQuadParticle {
private CritParticle(ClientLevel level, double x, double y, double z, double xa, double ya, double za, TextureAtlasSprite sprite) {
super(level, x, y, z, 0.0, 0.0, 0.0, sprite);
this.friction = 0.7F;
this.gravity = 0.5F;
this.xd *= 0.1F;
this.yd *= 0.1F;
this.zd *= 0.1F;
this.xd += xa * 0.4;
this.yd += ya * 0.4;
this.zd += za * 0.4;
float col = this.random.nextFloat() * 0.3F + 0.6F;
this.rCol = col;
this.gCol = col;
this.bCol = col;
this.quadSize *= 0.75F;
this.lifetime = Math.max((int)(6.0 / (this.random.nextFloat() * 0.8 + 0.6)), 1);
this.hasPhysics = false;
this.tick();
}
@Override
public float getQuadSize(float a) {
return this.quadSize * Mth.clamp((this.age + a) / this.lifetime * 32.0F, 0.0F, 1.0F);
}
@Override
public void tick() {
super.tick();
this.gCol *= 0.96F;
this.bCol *= 0.9F;
}
@Override
public SingleQuadParticle.Layer getLayer() {
return SingleQuadParticle.Layer.OPAQUE;
}
@OnlyIn(Dist.CLIENT)
public static class DamageIndicatorProvider implements ParticleProvider<SimpleParticleType> {
private final SpriteSet sprite;
public DamageIndicatorProvider(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
) {
CritParticle particle = new CritParticle(level, x, y, z, xAux, yAux + 1.0, zAux, this.sprite.get(random));
particle.setLifetime(20);
return particle;
}
}
@OnlyIn(Dist.CLIENT)
public static class MagicProvider implements ParticleProvider<SimpleParticleType> {
private final SpriteSet sprite;
public MagicProvider(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
) {
CritParticle particle = new CritParticle(level, x, y, z, xAux, yAux, zAux, this.sprite.get(random));
particle.rCol *= 0.3F;
particle.gCol *= 0.8F;
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 CritParticle(level, x, y, z, xAux, yAux, zAux, this.sprite.get(random));
}
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
继承/返回值
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Mth.clamp()
- 引用位置: