use of slimeknights.tconstruct.shared.particle.FluidParticleData in project TinkersConstruct by SlimeKnights.
the class SlurpingModifier method addFluidParticles.
/**
* Adds the given number of fluid particles
*/
private static void addFluidParticles(Player player, FluidStack fluid, int count) {
for (int i = 0; i < count; ++i) {
Vec3 motion = new Vec3((RANDOM.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D);
motion = motion.xRot(-player.getXRot() * DEGREE_TO_RADIANS);
motion = motion.yRot(-player.getYRot() * DEGREE_TO_RADIANS);
Vec3 position = new Vec3((RANDOM.nextFloat() - 0.5D) * 0.3D, (-RANDOM.nextFloat()) * 0.6D - 0.3D, 0.6D);
position = position.xRot(-player.getXRot() * DEGREE_TO_RADIANS);
position = position.yRot(-player.getYRot() * DEGREE_TO_RADIANS);
position = position.add(player.getX(), player.getEyeY(), player.getZ());
FluidParticleData data = new FluidParticleData(TinkerCommons.fluidParticle.get(), fluid);
if (player.level instanceof ServerLevel) {
((ServerLevel) player.level).sendParticles(data, position.x, position.y, position.z, 1, motion.x, motion.y + 0.05D, motion.z, 0.0D);
} else {
player.level.addParticle(data, position.x, position.y, position.z, motion.x, motion.y + 0.05D, motion.z);
}
}
}
Aggregations