How to stop entities from turning?

Discussion in 'Plugin Development' started by AstramG, Jun 28, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    AstramG

    I am trying to make a plugin where you can ride and control bats. This is what I have. It's a task that runs every 1 tick to make accurate movement.
    Code:
    public void run() {
            if (entity.isDead() == false) {
                Vector nvp = player.getLocation().getDirection().multiply(2);
                entity.setVelocity(nvp);
                float pitch = player.getLocation().getPitch();
                float yaw = player.getLocation().getYaw();
                entity.getLocation().setPitch(pitch);
                entity.getLocation().setYaw(yaw);
            } else {
                this.cancel();
            }
        }
    However, the bat seems to still look around which makes the player turn and the movement glitchy.
     
  2. Offline

    JeroenV

Thread Status:
Not open for further replies.

Share This Page