FlyTowardsPositionParticle.java
net.minecraft.client.particle.FlyTowardsPositionParticle
信息
- 全限定名:net.minecraft.client.particle.FlyTowardsPositionParticle
- 类型:public class
- 包:net.minecraft.client.particle
- 源码路径:src/main/java/net/minecraft/client/particle/FlyTowardsPositionParticle.java
- 起始行号:L14
- 继承:SingleQuadParticle
- 职责:
TODO
字段/常量
-
xStart- 类型:
double - 修饰符:
private final - 源码定位:
L15 - 说明:
TODO
- 类型:
-
yStart- 类型:
double - 修饰符:
private final - 源码定位:
L16 - 说明:
TODO
- 类型:
-
zStart- 类型:
double - 修饰符:
private final - 源码定位:
L17 - 说明:
TODO
- 类型:
-
isGlowing- 类型:
boolean - 修饰符:
private final - 源码定位:
L18 - 说明:
TODO
- 类型:
-
lifetimeAlpha- 类型:
Particle.LifetimeAlpha - 修饰符:
private final - 源码定位:
L19 - 说明:
TODO
- 类型:
内部类/嵌套类型
-
net.minecraft.client.particle.FlyTowardsPositionParticle.EnchantProvider- 类型:
class - 修饰符:
public static - 源码定位:
L111 - 说明:
TODO
- 类型:
-
net.minecraft.client.particle.FlyTowardsPositionParticle.NautilusProvider- 类型:
class - 修饰符:
public static - 源码定位:
L126 - 说明:
TODO
- 类型:
-
net.minecraft.client.particle.FlyTowardsPositionParticle.VaultConnectionProvider- 类型:
class - 修饰符:
public static - 源码定位:
L141 - 说明:
TODO
- 类型:
构造器
private FlyTowardsPositionParticle(ClientLevel level, double x, double y, double z, double xd, double yd, double zd, TextureAtlasSprite sprite) @ L21
- 构造器名:FlyTowardsPositionParticle
- 源码定位:L21
- 修饰符:private
参数:
- level: ClientLevel
- x: double
- y: double
- z: double
- xd: double
- yd: double
- zd: double
- sprite: TextureAtlasSprite
说明:
TODO
private FlyTowardsPositionParticle(ClientLevel level, double x, double y, double z, double xd, double yd, double zd, boolean isGlowing, Particle.LifetimeAlpha lifetimeAlpha, TextureAtlasSprite sprite) @ L25
- 构造器名:FlyTowardsPositionParticle
- 源码定位:L25
- 修饰符:private
参数:
- level: ClientLevel
- x: double
- y: double
- z: double
- xd: double
- yd: double
- zd: double
- isGlowing: boolean
- lifetimeAlpha: Particle.LifetimeAlpha
- sprite: TextureAtlasSprite
说明:
TODO
方法
下面的方法块按源码顺序生成。
public SingleQuadParticle.Layer getLayer() @ L62
- 方法名:getLayer
- 源码定位:L62
- 返回类型:SingleQuadParticle.Layer
- 修饰符:public
参数:
- 无
说明:
TODO
public void move(double xa, double ya, double za) @ L67
- 方法名:move
- 源码定位:L67
- 返回类型:void
- 修饰符:public
参数:
- xa: double
- ya: double
- za: double
说明:
TODO
public int getLightCoords(float a) @ L73
- 方法名:getLightCoords
- 源码定位:L73
- 返回类型:int
- 修饰符:public
参数:
- a: float
说明:
TODO
public void tick() @ L85
- 方法名:tick
- 源码定位:L85
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public void extract(QuadParticleRenderState particleTypeRenderState, Camera camera, float partialTickTime) @ L104
- 方法名:extract
- 源码定位:L104
- 返回类型:void
- 修饰符:public
参数:
- particleTypeRenderState: QuadParticleRenderState
- camera: Camera
- partialTickTime: float
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class FlyTowardsPositionParticle extends SingleQuadParticle {
private final double xStart;
private final double yStart;
private final double zStart;
private final boolean isGlowing;
private final Particle.LifetimeAlpha lifetimeAlpha;
private FlyTowardsPositionParticle(ClientLevel level, double x, double y, double z, double xd, double yd, double zd, TextureAtlasSprite sprite) {
this(level, x, y, z, xd, yd, zd, false, Particle.LifetimeAlpha.ALWAYS_OPAQUE, sprite);
}
private FlyTowardsPositionParticle(
ClientLevel level,
double x,
double y,
double z,
double xd,
double yd,
double zd,
boolean isGlowing,
Particle.LifetimeAlpha lifetimeAlpha,
TextureAtlasSprite sprite
) {
super(level, x, y, z, sprite);
this.isGlowing = isGlowing;
this.lifetimeAlpha = lifetimeAlpha;
this.setAlpha(lifetimeAlpha.startAlpha());
this.xd = xd;
this.yd = yd;
this.zd = zd;
this.xStart = x;
this.yStart = y;
this.zStart = z;
this.xo = x + xd;
this.yo = y + yd;
this.zo = z + zd;
this.x = this.xo;
this.y = this.yo;
this.z = this.zo;
this.quadSize = 0.1F * (this.random.nextFloat() * 0.5F + 0.2F);
float br = this.random.nextFloat() * 0.6F + 0.4F;
this.rCol = 0.9F * br;
this.gCol = 0.9F * br;
this.bCol = br;
this.hasPhysics = false;
this.lifetime = (int)(this.random.nextFloat() * 10.0F) + 30;
}
@Override
public SingleQuadParticle.Layer getLayer() {
return this.lifetimeAlpha.isOpaque() ? SingleQuadParticle.Layer.OPAQUE : SingleQuadParticle.Layer.TRANSLUCENT;
}
@Override
public void move(double xa, double ya, double za) {
this.setBoundingBox(this.getBoundingBox().move(xa, ya, za));
this.setLocationFromBoundingbox();
}
@Override
public int getLightCoords(float a) {
if (this.isGlowing) {
return LightCoordsUtil.withBlock(super.getLightCoords(a), 15);
} else {
float brightness = (float)this.age / this.lifetime;
brightness *= brightness;
brightness *= brightness;
return LightCoordsUtil.addSmoothBlockEmission(super.getLightCoords(a), brightness);
}
}
@Override
public void tick() {
this.xo = this.x;
this.yo = this.y;
this.zo = this.z;
if (this.age++ >= this.lifetime) {
this.remove();
} else {
float pos = (float)this.age / this.lifetime;
pos = 1.0F - pos;
float pp = 1.0F - pos;
pp *= pp;
pp *= pp;
this.x = this.xStart + this.xd * pos;
this.y = this.yStart + this.yd * pos - pp * 1.2F;
this.z = this.zStart + this.zd * pos;
}
}
@Override
public void extract(QuadParticleRenderState particleTypeRenderState, Camera camera, float partialTickTime) {
this.setAlpha(this.lifetimeAlpha.currentAlphaForAge(this.age, this.lifetime, partialTickTime));
super.extract(particleTypeRenderState, camera, partialTickTime);
}
@OnlyIn(Dist.CLIENT)
public static class EnchantProvider implements ParticleProvider<SimpleParticleType> {
private final SpriteSet sprite;
public EnchantProvider(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 FlyTowardsPositionParticle(level, x, y, z, xAux, yAux, zAux, this.sprite.get(random));
}
}
@OnlyIn(Dist.CLIENT)
public static class NautilusProvider implements ParticleProvider<SimpleParticleType> {
private final SpriteSet sprite;
public NautilusProvider(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 FlyTowardsPositionParticle(level, x, y, z, xAux, yAux, zAux, this.sprite.get(random));
}
}
@OnlyIn(Dist.CLIENT)
public static class VaultConnectionProvider implements ParticleProvider<SimpleParticleType> {
private final SpriteSet sprite;
public VaultConnectionProvider(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
) {
FlyTowardsPositionParticle particle = new FlyTowardsPositionParticle(
level, x, y, z, xAux, yAux, zAux, true, new Particle.LifetimeAlpha(0.0F, 0.6F, 0.25F, 1.0F), this.sprite.get(random)
);
particle.scale(1.5F);
return particle;
}
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数/字段/方法调用/构造调用 - 关联成员:
LifetimeAlpha(), Particle.LifetimeAlpha()
- 引用位置:
-
- 引用位置:
继承/返回值
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
LightCoordsUtil.addSmoothBlockEmission(), LightCoordsUtil.withBlock()
- 引用位置: