SingleQuadParticle.java
net.minecraft.client.particle.SingleQuadParticle
信息
- 全限定名:net.minecraft.client.particle.SingleQuadParticle
- 类型:public abstract class
- 包:net.minecraft.client.particle
- 源码路径:src/main/java/net/minecraft/client/particle/SingleQuadParticle.java
- 起始行号:L19
- 继承:Particle
- 职责:
TODO
字段/常量
-
quadSize- 类型:
float - 修饰符:
protected - 源码定位:
L20 - 说明:
TODO
- 类型:
-
rCol- 类型:
float - 修饰符:
protected - 源码定位:
L21 - 说明:
TODO
- 类型:
-
gCol- 类型:
float - 修饰符:
protected - 源码定位:
L22 - 说明:
TODO
- 类型:
-
bCol- 类型:
float - 修饰符:
protected - 源码定位:
L23 - 说明:
TODO
- 类型:
-
alpha- 类型:
float - 修饰符:
protected - 源码定位:
L24 - 说明:
TODO
- 类型:
-
roll- 类型:
float - 修饰符:
protected - 源码定位:
L25 - 说明:
TODO
- 类型:
-
oRoll- 类型:
float - 修饰符:
protected - 源码定位:
L26 - 说明:
TODO
- 类型:
-
sprite- 类型:
TextureAtlasSprite - 修饰符:
protected - 源码定位:
L27 - 说明:
TODO
- 类型:
内部类/嵌套类型
-
net.minecraft.client.particle.SingleQuadParticle.FacingCameraMode- 类型:
interface - 修饰符:
public - 源码定位:
L158 - 说明:
TODO
- 类型:
-
net.minecraft.client.particle.SingleQuadParticle.Layer- 类型:
record - 修饰符:
public - 源码定位:
L166 - 说明:
TODO
- 类型:
构造器
protected SingleQuadParticle(ClientLevel level, double x, double y, double z, TextureAtlasSprite sprite) @ L29
- 构造器名:SingleQuadParticle
- 源码定位:L29
- 修饰符:protected
参数:
- level: ClientLevel
- x: double
- y: double
- z: double
- sprite: TextureAtlasSprite
说明:
TODO
protected SingleQuadParticle(ClientLevel level, double x, double y, double z, double xa, double ya, double za, TextureAtlasSprite sprite) @ L35
- 构造器名:SingleQuadParticle
- 源码定位:L35
- 修饰符:protected
参数:
- level: ClientLevel
- x: double
- y: double
- z: double
- xa: double
- ya: double
- za: double
- sprite: TextureAtlasSprite
说明:
TODO
方法
下面的方法块按源码顺序生成。
public SingleQuadParticle.FacingCameraMode getFacingCameraMode() @ L41
- 方法名:getFacingCameraMode
- 源码定位:L41
- 返回类型:SingleQuadParticle.FacingCameraMode
- 修饰符:public
参数:
- 无
说明:
TODO
public void extract(QuadParticleRenderState particleTypeRenderState, Camera camera, float partialTickTime) @ L45
- 方法名:extract
- 源码定位:L45
- 返回类型:void
- 修饰符:public
参数:
- particleTypeRenderState: QuadParticleRenderState
- camera: Camera
- partialTickTime: float
说明:
TODO
protected void extractRotatedQuad(QuadParticleRenderState particleTypeRenderState, Camera camera, Quaternionf rotation, float partialTickTime) @ L55
- 方法名:extractRotatedQuad
- 源码定位:L55
- 返回类型:void
- 修饰符:protected
参数:
- particleTypeRenderState: QuadParticleRenderState
- camera: Camera
- rotation: Quaternionf
- partialTickTime: float
说明:
TODO
protected void extractRotatedQuad(QuadParticleRenderState particleTypeRenderState, Quaternionf rotation, float x, float y, float z, float partialTickTime) @ L63
- 方法名:extractRotatedQuad
- 源码定位:L63
- 返回类型:void
- 修饰符:protected
参数:
- particleTypeRenderState: QuadParticleRenderState
- rotation: Quaternionf
- x: float
- y: float
- z: float
- partialTickTime: float
说明:
TODO
public float getQuadSize(float a) @ L83
- 方法名:getQuadSize
- 源码定位:L83
- 返回类型:float
- 修饰符:public
参数:
- a: float
说明:
TODO
public Particle scale(float scale) @ L87
- 方法名:scale
- 源码定位:L87
- 返回类型:Particle
- 修饰符:public
参数:
- scale: float
说明:
TODO
public ParticleRenderType getGroup() @ L93
- 方法名:getGroup
- 源码定位:L93
- 返回类型:ParticleRenderType
- 修饰符:public
参数:
- 无
说明:
TODO
public void setSpriteFromAge(SpriteSet sprites) @ L98
- 方法名:setSpriteFromAge
- 源码定位:L98
- 返回类型:void
- 修饰符:public
参数:
- sprites: SpriteSet
说明:
TODO
protected void setSprite(TextureAtlasSprite icon) @ L104
- 方法名:setSprite
- 源码定位:L104
- 返回类型:void
- 修饰符:protected
参数:
- icon: TextureAtlasSprite
说明:
TODO
protected float getU0() @ L108
- 方法名:getU0
- 源码定位:L108
- 返回类型:float
- 修饰符:protected
参数:
- 无
说明:
TODO
protected float getU1() @ L112
- 方法名:getU1
- 源码定位:L112
- 返回类型:float
- 修饰符:protected
参数:
- 无
说明:
TODO
protected float getV0() @ L116
- 方法名:getV0
- 源码定位:L116
- 返回类型:float
- 修饰符:protected
参数:
- 无
说明:
TODO
protected float getV1() @ L120
- 方法名:getV1
- 源码定位:L120
- 返回类型:float
- 修饰符:protected
参数:
- 无
说明:
TODO
protected abstract SingleQuadParticle.Layer getLayer() @ L124
- 方法名:getLayer
- 源码定位:L124
- 返回类型:SingleQuadParticle.Layer
- 修饰符:protected abstract
参数:
- 无
说明:
TODO
public void setColor(float r, float g, float b) @ L126
- 方法名:setColor
- 源码定位:L126
- 返回类型:void
- 修饰符:public
参数:
- r: float
- g: float
- b: float
说明:
TODO
protected void setAlpha(float alpha) @ L132
- 方法名:setAlpha
- 源码定位:L132
- 返回类型:void
- 修饰符:protected
参数:
- alpha: float
说明:
TODO
public String toString() @ L136
- 方法名:toString
- 源码定位:L136
- 返回类型:String
- 修饰符:public
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public abstract class SingleQuadParticle extends Particle {
protected float quadSize;
protected float rCol = 1.0F;
protected float gCol = 1.0F;
protected float bCol = 1.0F;
protected float alpha = 1.0F;
protected float roll;
protected float oRoll;
protected TextureAtlasSprite sprite;
protected SingleQuadParticle(ClientLevel level, double x, double y, double z, TextureAtlasSprite sprite) {
super(level, x, y, z);
this.sprite = sprite;
this.quadSize = 0.1F * (this.random.nextFloat() * 0.5F + 0.5F) * 2.0F;
}
protected SingleQuadParticle(ClientLevel level, double x, double y, double z, double xa, double ya, double za, TextureAtlasSprite sprite) {
super(level, x, y, z, xa, ya, za);
this.sprite = sprite;
this.quadSize = 0.1F * (this.random.nextFloat() * 0.5F + 0.5F) * 2.0F;
}
public SingleQuadParticle.FacingCameraMode getFacingCameraMode() {
return SingleQuadParticle.FacingCameraMode.LOOKAT_XYZ;
}
public void extract(QuadParticleRenderState particleTypeRenderState, Camera camera, float partialTickTime) {
Quaternionf rotation = new Quaternionf();
this.getFacingCameraMode().setRotation(rotation, camera, partialTickTime);
if (this.roll != 0.0F) {
rotation.rotateZ(Mth.lerp(partialTickTime, this.oRoll, this.roll));
}
this.extractRotatedQuad(particleTypeRenderState, camera, rotation, partialTickTime);
}
protected void extractRotatedQuad(QuadParticleRenderState particleTypeRenderState, Camera camera, Quaternionf rotation, float partialTickTime) {
Vec3 pos = camera.position();
float x = (float)(Mth.lerp((double)partialTickTime, this.xo, this.x) - pos.x());
float y = (float)(Mth.lerp((double)partialTickTime, this.yo, this.y) - pos.y());
float z = (float)(Mth.lerp((double)partialTickTime, this.zo, this.z) - pos.z());
this.extractRotatedQuad(particleTypeRenderState, rotation, x, y, z, partialTickTime);
}
protected void extractRotatedQuad(QuadParticleRenderState particleTypeRenderState, Quaternionf rotation, float x, float y, float z, float partialTickTime) {
particleTypeRenderState.add(
this.getLayer(),
x,
y,
z,
rotation.x,
rotation.y,
rotation.z,
rotation.w,
this.getQuadSize(partialTickTime),
this.getU0(),
this.getU1(),
this.getV0(),
this.getV1(),
ARGB.colorFromFloat(this.alpha, this.rCol, this.gCol, this.bCol),
this.getLightCoords(partialTickTime)
);
}
public float getQuadSize(float a) {
return this.quadSize;
}
@Override
public Particle scale(float scale) {
this.quadSize *= scale;
return super.scale(scale);
}
@Override
public ParticleRenderType getGroup() {
return ParticleRenderType.SINGLE_QUADS;
}
public void setSpriteFromAge(SpriteSet sprites) {
if (!this.removed) {
this.setSprite(sprites.get(this.age, this.lifetime));
}
}
protected void setSprite(TextureAtlasSprite icon) {
this.sprite = icon;
}
protected float getU0() {
return this.sprite.getU0();
}
protected float getU1() {
return this.sprite.getU1();
}
protected float getV0() {
return this.sprite.getV0();
}
protected float getV1() {
return this.sprite.getV1();
}
protected abstract SingleQuadParticle.Layer getLayer();
public void setColor(float r, float g, float b) {
this.rCol = r;
this.gCol = g;
this.bCol = b;
}
protected void setAlpha(float alpha) {
this.alpha = alpha;
}
@Override
public String toString() {
return this.getClass().getSimpleName()
+ ", Pos ("
+ this.x
+ ","
+ this.y
+ ","
+ this.z
+ "), RGBA ("
+ this.rCol
+ ","
+ this.gCol
+ ","
+ this.bCol
+ ","
+ this.alpha
+ "), Age "
+ this.age;
}
@OnlyIn(Dist.CLIENT)
public interface FacingCameraMode {
SingleQuadParticle.FacingCameraMode LOOKAT_XYZ = (target, camera, partialTickTime) -> target.set(camera.rotation());
SingleQuadParticle.FacingCameraMode LOOKAT_Y = (target, camera, partialTickTime) -> target.set(0.0F, camera.rotation().y, 0.0F, camera.rotation().w);
void setRotation(final Quaternionf target, final Camera camera, final float partialTickTime);
}
@OnlyIn(Dist.CLIENT)
public record Layer(boolean translucent, Identifier textureAtlasLocation, RenderPipeline pipeline) {
public static final SingleQuadParticle.Layer OPAQUE_TERRAIN = new SingleQuadParticle.Layer(
false, TextureAtlas.LOCATION_BLOCKS, RenderPipelines.OPAQUE_PARTICLE
);
public static final SingleQuadParticle.Layer TRANSLUCENT_TERRAIN = new SingleQuadParticle.Layer(
true, TextureAtlas.LOCATION_BLOCKS, RenderPipelines.TRANSLUCENT_PARTICLE
);
public static final SingleQuadParticle.Layer OPAQUE_ITEMS = new SingleQuadParticle.Layer(
false, TextureAtlas.LOCATION_ITEMS, RenderPipelines.OPAQUE_PARTICLE
);
public static final SingleQuadParticle.Layer TRANSLUCENT_ITEMS = new SingleQuadParticle.Layer(
true, TextureAtlas.LOCATION_ITEMS, RenderPipelines.TRANSLUCENT_PARTICLE
);
public static final SingleQuadParticle.Layer OPAQUE = new SingleQuadParticle.Layer(
false, TextureAtlas.LOCATION_PARTICLES, RenderPipelines.OPAQUE_PARTICLE
);
public static final SingleQuadParticle.Layer TRANSLUCENT = new SingleQuadParticle.Layer(
true, TextureAtlas.LOCATION_PARTICLES, RenderPipelines.TRANSLUCENT_PARTICLE
);
public static SingleQuadParticle.Layer bySprite(TextureAtlasSprite sprite) {
boolean translucent = sprite.transparency().hasTranslucent();
if (sprite.atlasLocation().equals(TextureAtlas.LOCATION_BLOCKS)) {
return translucent ? TRANSLUCENT_TERRAIN : OPAQUE_TERRAIN;
} else if (sprite.atlasLocation().equals(TextureAtlas.LOCATION_ITEMS)) {
return translucent ? TRANSLUCENT_ITEMS : OPAQUE_ITEMS;
} else {
return translucent ? TRANSLUCENT : OPAQUE;
}
}
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
继承/返回值
- 引用位置:
-
- 引用位置:
返回值
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
ARGB.colorFromFloat()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Mth.lerp()
- 引用位置: