CampfireSmokeParticle.java
net.minecraft.client.particle.CampfireSmokeParticle
信息
- 全限定名:net.minecraft.client.particle.CampfireSmokeParticle
- 类型:public class
- 包:net.minecraft.client.particle
- 源码路径:src/main/java/net/minecraft/client/particle/CampfireSmokeParticle.java
- 起始行号:L11
- 继承:SingleQuadParticle
- 职责:
TODO
字段/常量
- 无
内部类/嵌套类型
-
net.minecraft.client.particle.CampfireSmokeParticle.CosyProvider- 类型:
class - 修饰符:
public static - 源码定位:
L54 - 说明:
TODO
- 类型:
-
net.minecraft.client.particle.CampfireSmokeParticle.SignalProvider- 类型:
class - 修饰符:
public static - 源码定位:
L71 - 说明:
TODO
- 类型:
构造器
private CampfireSmokeParticle(ClientLevel level, double x, double y, double z, double xa, double ya, double za, boolean isSignalFire, TextureAtlasSprite sprite) @ L12
- 构造器名:CampfireSmokeParticle
- 源码定位:L12
- 修饰符:private
参数:
- level: ClientLevel
- x: double
- y: double
- z: double
- xa: double
- ya: double
- za: double
- isSignalFire: boolean
- sprite: TextureAtlasSprite
说明:
TODO
方法
下面的方法块按源码顺序生成。
public void tick() @ L30
- 方法名:tick
- 源码定位:L30
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public SingleQuadParticle.Layer getLayer() @ L48
- 方法名:getLayer
- 源码定位:L48
- 返回类型:SingleQuadParticle.Layer
- 修饰符:public
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class CampfireSmokeParticle extends SingleQuadParticle {
private CampfireSmokeParticle(
ClientLevel level, double x, double y, double z, double xa, double ya, double za, boolean isSignalFire, TextureAtlasSprite sprite
) {
super(level, x, y, z, sprite);
this.scale(3.0F);
this.setSize(0.25F, 0.25F);
if (isSignalFire) {
this.lifetime = this.random.nextInt(50) + 280;
} else {
this.lifetime = this.random.nextInt(50) + 80;
}
this.gravity = 3.0E-6F;
this.xd = xa;
this.yd = ya + this.random.nextFloat() / 500.0F;
this.zd = za;
}
@Override
public void tick() {
this.xo = this.x;
this.yo = this.y;
this.zo = this.z;
if (this.age++ < this.lifetime && !(this.alpha <= 0.0F)) {
this.xd = this.xd + this.random.nextFloat() / 5000.0F * (this.random.nextBoolean() ? 1 : -1);
this.zd = this.zd + this.random.nextFloat() / 5000.0F * (this.random.nextBoolean() ? 1 : -1);
this.yd = this.yd - this.gravity;
this.move(this.xd, this.yd, this.zd);
if (this.age >= this.lifetime - 60 && this.alpha > 0.01F) {
this.alpha -= 0.015F;
}
} else {
this.remove();
}
}
@Override
public SingleQuadParticle.Layer getLayer() {
return SingleQuadParticle.Layer.TRANSLUCENT;
}
@OnlyIn(Dist.CLIENT)
public static class CosyProvider implements ParticleProvider<SimpleParticleType> {
private final SpriteSet sprites;
public CosyProvider(SpriteSet sprites) {
this.sprites = sprites;
}
public Particle createParticle(
SimpleParticleType options, ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, RandomSource random
) {
CampfireSmokeParticle particle = new CampfireSmokeParticle(level, x, y, z, xAux, yAux, zAux, false, this.sprites.get(random));
particle.setAlpha(0.9F);
return particle;
}
}
@OnlyIn(Dist.CLIENT)
public static class SignalProvider implements ParticleProvider<SimpleParticleType> {
private final SpriteSet sprites;
public SignalProvider(SpriteSet sprites) {
this.sprites = sprites;
}
public Particle createParticle(
SimpleParticleType options, ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, RandomSource random
) {
CampfireSmokeParticle particle = new CampfireSmokeParticle(level, x, y, z, xAux, yAux, zAux, true, this.sprites.get(random));
particle.setAlpha(0.95F);
return particle;
}
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
继承/返回值
- 引用位置:
-
- 引用位置:
参数
- 引用位置: