WaterDropParticle.java
net.minecraft.client.particle.WaterDropParticle
信息
- 全限定名:net.minecraft.client.particle.WaterDropParticle
- 类型:public class
- 包:net.minecraft.client.particle
- 源码路径:src/main/java/net/minecraft/client/particle/WaterDropParticle.java
- 起始行号:L13
- 继承:SingleQuadParticle
- 职责:
TODO
字段/常量
- 无
内部类/嵌套类型
net.minecraft.client.particle.WaterDropParticle.Provider- 类型:
class - 修饰符:
public static - 源码定位:
L63 - 说明:
TODO
- 类型:
构造器
protected WaterDropParticle(ClientLevel level, double x, double y, double z, TextureAtlasSprite sprite) @ L14
- 构造器名:WaterDropParticle
- 源码定位:L14
- 修饰符:protected
参数:
- level: ClientLevel
- x: double
- y: double
- z: double
- sprite: TextureAtlasSprite
说明:
TODO
方法
下面的方法块按源码顺序生成。
public SingleQuadParticle.Layer getLayer() @ L24
- 方法名:getLayer
- 源码定位:L24
- 返回类型:SingleQuadParticle.Layer
- 修饰符:public
参数:
- 无
说明:
TODO
public void tick() @ L29
- 方法名:tick
- 源码定位:L29
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class WaterDropParticle extends SingleQuadParticle {
protected WaterDropParticle(ClientLevel level, double x, double y, double z, TextureAtlasSprite sprite) {
super(level, x, y, z, 0.0, 0.0, 0.0, sprite);
this.xd *= 0.3F;
this.yd = this.random.nextFloat() * 0.2F + 0.1F;
this.zd *= 0.3F;
this.setSize(0.01F, 0.01F);
this.gravity = 0.06F;
this.lifetime = (int)(8.0 / (this.random.nextFloat() * 0.8 + 0.2));
}
@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.lifetime-- <= 0) {
this.remove();
} else {
this.yd = this.yd - this.gravity;
this.move(this.xd, this.yd, this.zd);
this.xd *= 0.98F;
this.yd *= 0.98F;
this.zd *= 0.98F;
if (this.onGround) {
if (this.random.nextFloat() < 0.5F) {
this.remove();
}
this.xd *= 0.7F;
this.zd *= 0.7F;
}
BlockPos pos = BlockPos.containing(this.x, this.y, this.z);
double offset = Math.max(
this.level.getBlockState(pos).getCollisionShape(this.level, pos).max(Direction.Axis.Y, this.x - pos.getX(), this.z - pos.getZ()),
(double)this.level.getFluidState(pos).getHeight(this.level, pos)
);
if (offset > 0.0 && this.y < pos.getY() + offset) {
this.remove();
}
}
}
@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 WaterDropParticle(level, x, y, z, this.sprite.get(random));
}
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
继承/返回值
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
BlockPos.containing()
- 引用位置: