TrailParticle.java
net.minecraft.client.particle.TrailParticle
信息
- 全限定名:net.minecraft.client.particle.TrailParticle
- 类型:public class
- 包:net.minecraft.client.particle
- 源码路径:src/main/java/net/minecraft/client/particle/TrailParticle.java
- 起始行号:L14
- 继承:SingleQuadParticle
- 职责:
TODO
字段/常量
target- 类型:
Vec3 - 修饰符:
private final - 源码定位:
L15 - 说明:
TODO
- 类型:
内部类/嵌套类型
net.minecraft.client.particle.TrailParticle.Provider- 类型:
class - 修饰符:
public static - 源码定位:
L58 - 说明:
TODO
- 类型:
构造器
private TrailParticle(ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, Vec3 target, int color, TextureAtlasSprite sprite) @ L17
- 构造器名:TrailParticle
- 源码定位:L17
- 修饰符:private
参数:
- level: ClientLevel
- x: double
- y: double
- z: double
- xAux: double
- yAux: double
- zAux: double
- target: Vec3
- color: int
- sprite: TextureAtlasSprite
说明:
TODO
方法
下面的方法块按源码顺序生成。
public SingleQuadParticle.Layer getLayer() @ L31
- 方法名:getLayer
- 源码定位:L31
- 返回类型:SingleQuadParticle.Layer
- 修饰符:public
参数:
- 无
说明:
TODO
public void tick() @ L36
- 方法名:tick
- 源码定位:L36
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public int getLightCoords(float a) @ L52
- 方法名:getLightCoords
- 源码定位:L52
- 返回类型:int
- 修饰符:public
参数:
- a: float
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class TrailParticle extends SingleQuadParticle {
private final Vec3 target;
private TrailParticle(
ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, Vec3 target, int color, TextureAtlasSprite sprite
) {
super(level, x, y, z, xAux, yAux, zAux, sprite);
color = ARGB.scaleRGB(
color, 0.875F + this.random.nextFloat() * 0.25F, 0.875F + this.random.nextFloat() * 0.25F, 0.875F + this.random.nextFloat() * 0.25F
);
this.rCol = ARGB.red(color) / 255.0F;
this.gCol = ARGB.green(color) / 255.0F;
this.bCol = ARGB.blue(color) / 255.0F;
this.quadSize = 0.26F;
this.target = target;
}
@Override
public SingleQuadParticle.Layer getLayer() {
return SingleQuadParticle.Layer.OPAQUE;
}
@Override
public void tick() {
this.xo = this.x;
this.yo = this.y;
this.zo = this.z;
if (this.age++ >= this.lifetime) {
this.remove();
} else {
int ticksRemaining = this.lifetime - this.age;
double alpha = 1.0 / ticksRemaining;
this.x = Mth.lerp(alpha, this.x, this.target.x());
this.y = Mth.lerp(alpha, this.y, this.target.y());
this.z = Mth.lerp(alpha, this.z, this.target.z());
}
}
@Override
public int getLightCoords(float a) {
return 15728880;
}
@OnlyIn(Dist.CLIENT)
public static class Provider implements ParticleProvider<TrailParticleOption> {
private final SpriteSet sprite;
public Provider(SpriteSet sprite) {
this.sprite = sprite;
}
public Particle createParticle(
TrailParticleOption options, ClientLevel level, double x, double y, double z, double xAux, double yAux, double zAux, RandomSource random
) {
TrailParticle particle = new TrailParticle(level, x, y, z, xAux, yAux, zAux, options.target(), options.color(), this.sprite.get(random));
particle.setLifetime(options.duration());
return particle;
}
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
继承/返回值
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
ARGB.blue(), ARGB.green(), ARGB.red(), ARGB.scaleRGB()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Mth.lerp()
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置: