use of net.silentchaos512.gems.network.message.MessageTransferParticles in project SilentGems by SilentChaos512.
the class NodePacketHelper method spawnParticles.
public static void spawnParticles(World world, Vec3d from, Vec3d to, int color) {
if (!world.isRemote) {
// We can only spawn particles on the client, so send a packet out to the clients if we try to do this on the
// server side!
NetworkHandler.INSTANCE.sendToAllAround(new MessageTransferParticles(from, to, color), new TargetPoint(world.provider.getDimension(), from.x, from.y, from.z, 64));
return;
}
final int stepCount = 20 - 4 * SilentGems.proxy.getParticleSettings();
final double distance = (float) from.distanceTo(to);
final double stepX = (to.x - from.x) / stepCount;
final double stepY = (to.y - from.y) / stepCount;
final double stepZ = (to.z - from.z) / stepCount;
for (int i = 0; i <= stepCount; ++i) {
double x = from.x + stepX * i;
double y = from.y + stepY * i;
double z = from.z + stepZ * i;
double motionX = 0.0075 * SilentGems.random.nextGaussian();
double motionY = 0.0075 * SilentGems.random.nextGaussian();
double motionZ = 0.0075 * SilentGems.random.nextGaussian();
for (int j = 0; j < 4 - SilentGems.proxy.getParticleSettings(); ++j) {
SilentGems.proxy.spawnParticles(EnumModParticles.CHAOS_PACKET_TAIL, new Color(color), world, x, y, z, motionX, motionY, motionZ);
}
}
}
Aggregations