SimpleAnimatedParticle.java
net.minecraft.client.particle.SimpleAnimatedParticle
信息
- 全限定名:net.minecraft.client.particle.SimpleAnimatedParticle
- 类型:public abstract class
- 包:net.minecraft.client.particle
- 源码路径:src/main/java/net/minecraft/client/particle/SimpleAnimatedParticle.java
- 起始行号:L8
- 继承:SingleQuadParticle
- 职责:
TODO
字段/常量
-
sprites- 类型:
SpriteSet - 修饰符:
protected final - 源码定位:
L9 - 说明:
TODO
- 类型:
-
fadeR- 类型:
float - 修饰符:
private - 源码定位:
L10 - 说明:
TODO
- 类型:
-
fadeG- 类型:
float - 修饰符:
private - 源码定位:
L11 - 说明:
TODO
- 类型:
-
fadeB- 类型:
float - 修饰符:
private - 源码定位:
L12 - 说明:
TODO
- 类型:
-
hasFade- 类型:
boolean - 修饰符:
private - 源码定位:
L13 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
protected SimpleAnimatedParticle(ClientLevel level, double x, double y, double z, SpriteSet sprites, float gravity) @ L15
- 构造器名:SimpleAnimatedParticle
- 源码定位:L15
- 修饰符:protected
参数:
- level: ClientLevel
- x: double
- y: double
- z: double
- sprites: SpriteSet
- gravity: float
说明:
TODO
方法
下面的方法块按源码顺序生成。
public void setColor(int rgb) @ L22
- 方法名:setColor
- 源码定位:L22
- 返回类型:void
- 修饰符:public
参数:
- rgb: int
说明:
TODO
public void setFadeColor(int rgb) @ L30
- 方法名:setFadeColor
- 源码定位:L30
- 返回类型:void
- 修饰符:public
参数:
- rgb: int
说明:
TODO
public SingleQuadParticle.Layer getLayer() @ L37
- 方法名:getLayer
- 源码定位:L37
- 返回类型:SingleQuadParticle.Layer
- 修饰符:public
参数:
- 无
说明:
TODO
public void tick() @ L42
- 方法名:tick
- 源码定位:L42
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public int getLightCoords(float a) @ L56
- 方法名:getLightCoords
- 源码定位:L56
- 返回类型:int
- 修饰符:public
参数:
- a: float
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public abstract class SimpleAnimatedParticle extends SingleQuadParticle {
protected final SpriteSet sprites;
private float fadeR;
private float fadeG;
private float fadeB;
private boolean hasFade;
protected SimpleAnimatedParticle(ClientLevel level, double x, double y, double z, SpriteSet sprites, float gravity) {
super(level, x, y, z, sprites.first());
this.friction = 0.91F;
this.gravity = gravity;
this.sprites = sprites;
}
public void setColor(int rgb) {
float r = ((rgb & 0xFF0000) >> 16) / 255.0F;
float g = ((rgb & 0xFF00) >> 8) / 255.0F;
float b = ((rgb & 0xFF) >> 0) / 255.0F;
float scale = 1.0F;
this.setColor(r * 1.0F, g * 1.0F, b * 1.0F);
}
public void setFadeColor(int rgb) {
this.fadeR = ((rgb & 0xFF0000) >> 16) / 255.0F;
this.fadeG = ((rgb & 0xFF00) >> 8) / 255.0F;
this.fadeB = ((rgb & 0xFF) >> 0) / 255.0F;
this.hasFade = true;
}
@Override
public SingleQuadParticle.Layer getLayer() {
return SingleQuadParticle.Layer.TRANSLUCENT;
}
@Override
public void tick() {
super.tick();
this.setSpriteFromAge(this.sprites);
if (this.age > this.lifetime / 2) {
this.setAlpha(1.0F - ((float)this.age - this.lifetime / 2) / this.lifetime);
if (this.hasFade) {
this.rCol = this.rCol + (this.fadeR - this.rCol) * 0.2F;
this.gCol = this.gCol + (this.fadeG - this.gCol) * 0.2F;
this.bCol = this.bCol + (this.fadeB - this.bCol) * 0.2F;
}
}
}
@Override
public int getLightCoords(float a) {
return 15728880;
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
继承/返回值
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置: