Package net.minecraft.server

Examples of net.minecraft.server.Navigation


   * @param speed to move with
   */
  public void moveTo(Location location, double speed) {
    EntityLiving nmsEntity = CommonNMS.getNative(this.entity);
    if(nmsEntity instanceof EntityInsentient) {
      Navigation navigation = (Navigation) EntityLivingRef.getNavigation.invoke(nmsEntity);
      double x = location.getX();
      double y = location.getY();
      double z = location.getZ();
      if(!navigation.a(x, y, z, speed)) {
        int dx = MathUtil.floor(x);
        int dy = (int) y;
        int dz = MathUtil.floor(z);
        PathEntity path = nmsEntity.world.a(nmsEntity, dx, dy, dz, (float) this.getPathfindingRange(), true, false, false, true);
        this.moveWithPath(path, speed);
View Full Code Here


   */
  public void moveTo(Entity entity, double speed) {
    EntityLiving nmsEntity = CommonNMS.getNative(this.entity);
    net.minecraft.server.Entity nmsTargetEntity = CommonNMS.getNative(entity);
    if(nmsEntity instanceof EntityInsentient) {
      Navigation navigation = (Navigation) EntityLivingRef.getNavigation.invoke(nmsEntity);
      if(!navigation.a(nmsTargetEntity, speed)) {
        PathEntity path = nmsEntity.world.findPath(nmsEntity, nmsTargetEntity, (float) this.getPathfindingRange(), true, false, false, true);
        this.moveWithPath(path, speed);
      }
    }
  }
View Full Code Here

    EntityLiving nmsEntity = CommonNMS.getNative(entity);
    if(nmsEntity instanceof EntityInsentient) {
      if(nmsEntity instanceof EntityCreature)
        ((EntityCreature) nmsEntity).setPathEntity(path);
     
      Navigation navigation = (Navigation) EntityLivingRef.getNavigation.invoke(nmsEntity);
      navigation.a(path, speed);
    }
  }
View Full Code Here

TOP

Related Classes of net.minecraft.server.Navigation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.