Search in sources :

Example 1 with EulerAngle

use of com.builtbroken.mc.lib.transform.rotation.EulerAngle in project Engine by VoltzEngine-Project.

the class PacketSpawnParticleCircle method handleClientSide.

@Override
public void handleClientSide(EntityPlayer player) {
    if (// TODO add error logging as neither condition should happen
    player.worldObj.provider.dimensionId == dim && name != null && !name.isEmpty()) {
        if (Engine.runningAsDev && distance <= 1) {
            Engine.logger().error("PacketSpawnParticleCircle: Size of " + distance + " is to small to render effectively. " + new Pos(x, y, z).toString());
            return;
        }
        double c = 2 * Math.PI * distance;
        int particles = (int) Math.ceil(c) / 2;
        if (particles % 2 == 1) {
            particles += 1;
        }
        particles *= 5;
        double angleSeg = 360.0 / (double) particles;
        for (int i = 0; i < particles; i++) {
            EulerAngle angle = new EulerAngle(angleSeg * i, 0);
            Pos pos = angle.toPos().multiply(distance).add(x, y, z);
            player.worldObj.spawnParticle(name, pos.x(), pos.y(), pos.z(), vx, vy, vz);
        }
    }
}
Also used : Pos(com.builtbroken.mc.lib.transform.vector.Pos) EulerAngle(com.builtbroken.mc.lib.transform.rotation.EulerAngle)

Aggregations

EulerAngle (com.builtbroken.mc.lib.transform.rotation.EulerAngle)1 Pos (com.builtbroken.mc.lib.transform.vector.Pos)1