DragonBreathParticle.java
net.minecraft.client.particle.DragonBreathParticle
信息
- 全限定名:net.minecraft.client.particle.DragonBreathParticle
- 类型:public class
- 包:net.minecraft.client.particle
- 源码路径:src/main/java/net/minecraft/client/particle/DragonBreathParticle.java
- 起始行号:L11
- 继承:SingleQuadParticle
- 职责:
TODO
字段/常量
-
COLOR_MIN- 类型:
int - 修饰符:
private static final - 源码定位:
L12 - 说明:
TODO
- 类型:
-
COLOR_MAX- 类型:
int - 修饰符:
private static final - 源码定位:
L13 - 说明:
TODO
- 类型:
-
COLOR_MIN_RED- 类型:
float - 修饰符:
private static final - 源码定位:
L14 - 说明:
TODO
- 类型:
-
COLOR_MIN_GREEN- 类型:
float - 修饰符:
private static final - 源码定位:
L15 - 说明:
TODO
- 类型:
-
COLOR_MIN_BLUE- 类型:
float - 修饰符:
private static final - 源码定位:
L16 - 说明:
TODO
- 类型:
-
COLOR_MAX_RED- 类型:
float - 修饰符:
private static final - 源码定位:
L17 - 说明:
TODO
- 类型:
-
COLOR_MAX_GREEN- 类型:
float - 修饰符:
private static final - 源码定位:
L18 - 说明:
TODO
- 类型:
-
COLOR_MAX_BLUE- 类型:
float - 修饰符:
private static final - 源码定位:
L19 - 说明:
TODO
- 类型:
-
hasHitGround- 类型:
boolean - 修饰符:
private - 源码定位:
L20 - 说明:
TODO
- 类型:
-
sprites- 类型:
SpriteSet - 修饰符:
private final - 源码定位:
L21 - 说明:
TODO
- 类型:
内部类/嵌套类型
net.minecraft.client.particle.DragonBreathParticle.Provider- 类型:
class - 修饰符:
public static - 源码定位:
L83 - 说明:
TODO
- 类型:
构造器
private DragonBreathParticle(ClientLevel level, double x, double y, double z, double xa, double ya, double za, SpriteSet sprites) @ L23
- 构造器名:DragonBreathParticle
- 源码定位:L23
- 修饰符:private
参数:
- level: ClientLevel
- x: double
- y: double
- z: double
- xa: double
- ya: double
- za: double
- sprites: SpriteSet
说明:
TODO
方法
下面的方法块按源码顺序生成。
public void tick() @ L40
- 方法名:tick
- 源码定位:L40
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public SingleQuadParticle.Layer getLayer() @ L72
- 方法名:getLayer
- 源码定位:L72
- 返回类型:SingleQuadParticle.Layer
- 修饰符:public
参数:
- 无
说明:
TODO
public float getQuadSize(float a) @ L77
- 方法名:getQuadSize
- 源码定位:L77
- 返回类型:float
- 修饰符:public
参数:
- a: float
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class DragonBreathParticle extends SingleQuadParticle {
private static final int COLOR_MIN = 11993298;
private static final int COLOR_MAX = 14614777;
private static final float COLOR_MIN_RED = 0.7176471F;
private static final float COLOR_MIN_GREEN = 0.0F;
private static final float COLOR_MIN_BLUE = 0.8235294F;
private static final float COLOR_MAX_RED = 0.8745098F;
private static final float COLOR_MAX_GREEN = 0.0F;
private static final float COLOR_MAX_BLUE = 0.9764706F;
private boolean hasHitGround;
private final SpriteSet sprites;
private DragonBreathParticle(ClientLevel level, double x, double y, double z, double xa, double ya, double za, SpriteSet sprites) {
super(level, x, y, z, sprites.first());
this.friction = 0.96F;
this.xd = xa;
this.yd = ya;
this.zd = za;
this.rCol = Mth.nextFloat(this.random, 0.7176471F, 0.8745098F);
this.gCol = Mth.nextFloat(this.random, 0.0F, 0.0F);
this.bCol = Mth.nextFloat(this.random, 0.8235294F, 0.9764706F);
this.quadSize *= 0.75F;
this.lifetime = (int)(20.0 / (this.random.nextFloat() * 0.8 + 0.2));
this.hasHitGround = false;
this.hasPhysics = false;
this.sprites = sprites;
this.setSpriteFromAge(sprites);
}
@Override
public void tick() {
this.xo = this.x;
this.yo = this.y;
this.zo = this.z;
if (this.age++ >= this.lifetime) {
this.remove();
} else {
this.setSpriteFromAge(this.sprites);
if (this.onGround) {
this.yd = 0.0;
this.hasHitGround = true;
}
if (this.hasHitGround) {
this.yd += 0.002;
}
this.move(this.xd, this.yd, this.zd);
if (this.y == this.yo) {
this.xd *= 1.1;
this.zd *= 1.1;
}
this.xd = this.xd * this.friction;
this.zd = this.zd * this.friction;
if (this.hasHitGround) {
this.yd = this.yd * this.friction;
}
}
}
@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 Provider implements ParticleProvider<PowerParticleOption> {
private final SpriteSet sprites;
public Provider(SpriteSet sprites) {
this.sprites = sprites;
}
public Particle createParticle(
PowerParticleOption options, ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, RandomSource random
) {
DragonBreathParticle particle = new DragonBreathParticle(level, x, y, z, xAux, yAux, zAux, this.sprites);
particle.setPower(options.getPower());
return particle;
}
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
继承/返回值
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Mth.clamp(), Mth.nextFloat()
- 引用位置: