Let a mob move in looking direction

Discussion in 'Plugin Development' started by Metal Julien, Mar 2, 2013.

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

    Metal Julien

    Hi, does anyone know a simple way to let a mob (Vehicle of the player) move towards the looking direction of a player with a specific speed? Would be awsum


    Thx, MJ
     
  2. Offline

    frozenpoptartmc

    sounds like a mineZ clone
     
  3. Offline

    kabbage

    Not exactly what you're asking, but you could probably adapt this to what you want to do with some math.
    Code:
    public void moveTo(LivingEntity entity, Location moveTo, float speed)
        {
            EntityLiving nmsEntity = ((CraftLivingEntity) entity).getHandle();
            // Create a path to the location
            PathEntity path = nmsEntity.getNavigation().a(moveTo.getX(), moveTo.getY(), moveTo.getZ());
            // Move to that path at 'speed' speed.
            nmsEntity.getNavigation().a(path, speed);
        }
    Note that most entities have a default speed of 0.23f, so base your speed off of that.
     
Thread Status:
Not open for further replies.

Share This Page