1.12.2 Here's A Creative Solution Using Vectors on a graph

Discussion in 'Spigot Plugin Development' started by FlameFOxYT, Feb 15, 2020.

  1. Vector arrow1Vector = p.getLocation().getDirection();
    Arrow arrow1 = p.launchProjectile(Arrow.class, arrow1Vector);
    if (arrow1.getVelocity().getX() < 1
    && arrow1.getVelocity().getX() > 0
    && arrow1.getVelocity().getZ() < 1
    && arrow1.getVelocity().getZ() > 0) {
    arrow1.setVelocity(arrow1Vector.setZ(arrow1.getVelocity().getZ() + arrow1Distance));
    arrow1.setVelocity(arrow1Vector.setX(arrow1.getVelocity().getX() - arrow1Distance));
    } else if (arrow1.getVelocity().getX() < 1
    && arrow1.getVelocity().getX() > 0
    && arrow1.getVelocity().getZ() > -1
    && arrow1.getVelocity().getZ() < 0) {
    arrow1.setVelocity(arrow1Vector.setZ(arrow1.getVelocity().getZ() + arrow1Distance));
    arrow1.setVelocity(arrow1Vector.setX(arrow1.getVelocity().getX() + arrow1Distance));
    } else if (arrow1.getVelocity().getX() > -1
    && arrow1.getVelocity().getX() < 0
    && arrow1.getVelocity().getZ() > -1
    && arrow1.getVelocity().getZ() < 0) {
    arrow1.setVelocity(arrow1Vector.setZ(arrow1.getVelocity().getZ() - arrow1Distance));
    arrow1.setVelocity(arrow1Vector.setX(arrow1.getVelocity().getX() + arrow1Distance));
    } else if (arrow1.getVelocity().getX() > -1
    && arrow1.getVelocity().getX() < 0
    && arrow1.getVelocity().getZ() < 1
    && arrow1.getVelocity().getZ() > 0) {
    arrow1.setVelocity(arrow1Vector.setZ(arrow1.getVelocity().getZ() - arrow1Distance));
    arrow1.setVelocity(arrow1Vector.setX(arrow1.getVelocity().getX() - arrow1Distance));
    }

    using this you can launch projectiles using vectors without changing the yaw,
    I know there are more simple solution i just wanted to do something more creative.