LavaParticle.java
net.minecraft.client.particle.LavaParticle
信息
- 全限定名:net.minecraft.client.particle.LavaParticle
- 类型:public class
- 包:net.minecraft.client.particle
- 源码路径:src/main/java/net/minecraft/client/particle/LavaParticle.java
- 起始行号:L13
- 继承:SingleQuadParticle
- 职责:
TODO
字段/常量
- 无
内部类/嵌套类型
net.minecraft.client.particle.LavaParticle.Provider- 类型:
class - 修饰符:
public static - 源码定位:
L54 - 说明:
TODO
- 类型:
构造器
private LavaParticle(ClientLevel level, double x, double y, double z, TextureAtlasSprite sprite) @ L14
- 构造器名:LavaParticle
- 源码定位:L14
- 修饰符:private
参数:
- level: ClientLevel
- x: double
- y: double
- z: double
- sprite: TextureAtlasSprite
说明:
TODO
方法
下面的方法块按源码顺序生成。
public SingleQuadParticle.Layer getLayer() @ L26
- 方法名:getLayer
- 源码定位:L26
- 返回类型:SingleQuadParticle.Layer
- 修饰符:public
参数:
- 无
说明:
TODO
public int getLightCoords(float a) @ L31
- 方法名:getLightCoords
- 源码定位:L31
- 返回类型:int
- 修饰符:public
参数:
- a: float
说明:
TODO
public float getQuadSize(float a) @ L36
- 方法名:getQuadSize
- 源码定位:L36
- 返回类型:float
- 修饰符:public
参数:
- a: float
说明:
TODO
public void tick() @ L42
- 方法名:tick
- 源码定位:L42
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class LavaParticle extends SingleQuadParticle {
private LavaParticle(ClientLevel level, double x, double y, double z, TextureAtlasSprite sprite) {
super(level, x, y, z, 0.0, 0.0, 0.0, sprite);
this.gravity = 0.75F;
this.friction = 0.999F;
this.xd *= 0.8F;
this.yd *= 0.8F;
this.zd *= 0.8F;
this.yd = this.random.nextFloat() * 0.4F + 0.05F;
this.quadSize = this.quadSize * (this.random.nextFloat() * 2.0F + 0.2F);
this.lifetime = (int)(16.0 / (this.random.nextFloat() * 0.8 + 0.2));
}
@Override
public SingleQuadParticle.Layer getLayer() {
return SingleQuadParticle.Layer.OPAQUE;
}
@Override
public int getLightCoords(float a) {
return LightCoordsUtil.withBlock(super.getLightCoords(a), 15);
}
@Override
public float getQuadSize(float a) {
float s = (this.age + a) / this.lifetime;
return this.quadSize * (1.0F - s * s);
}
@Override
public void tick() {
super.tick();
if (!this.removed) {
float odds = (float)this.age / this.lifetime;
if (this.random.nextFloat() > odds) {
this.level.addParticle(ParticleTypes.SMOKE, this.x, this.y, this.z, this.xd, this.yd, this.zd);
}
}
}
@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 LavaParticle(level, x, y, z, this.sprite.get(random));
}
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
继承/返回值
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
LightCoordsUtil.withBlock()
- 引用位置: