Delete the AI from an entity so that it can still get knokback

Discussion in 'Plugin Development' started by ZweiGeschleim, Aug 24, 2021.

  1. Offline

    ZweiGeschleim

    I'm coding a plugin that alows me to ride animals. I archived that the entity can be controled by the player using W A S D. But the problem is they are currently moving on their own if the player stops moving. And is there a possibility that the entity will rotate smoothly?

    I tried a lot to rotate the entity and the only way it works was:

    Code:
                    ((CraftEntity) ve).getHandle().pitch = (((CraftPlayer) player).getHandle().pitch) * -1;
                    ((CraftEntity) ve).getHandle().yaw = ((CraftPlayer) player).getHandle().yaw;
     
    Last edited: Aug 24, 2021
  2. Offline

    rudraksha007

    um, i m not that good at these but... just making the entity "noAI" and then setting its velocity to something would work...
     
  3. Offline

    davidclue

    @ZweiGeschleim
    Set the setNoAI field to true and use packets for smooth rotation.
    Code:
    PacketPlayOutEntityHeadRotation rotation = new PacketPlayOutEntityHeadRotation(entity, (byte) ((p.getLocation().getYaw() * 256.0F) / 360.0F));
     
  4. Offline

    ZweiGeschleim

    Entitys with noAI tag can't get velocity, just if they have the no gravity tag.


    Oh thanks i will try this ;D
     

Share This Page