Package org.bukkit.util

Examples of org.bukkit.util.Vector.normalize()


           
            double a = Math.abs(bLoc.getX() - loc.getX());
            double b = Math.abs(bLoc.getZ() - loc.getZ());
            double c = Math.sqrt((a*a + b*b));
           
            p.setVelocity(v.normalize().multiply(c*0.3).setY(0.8));
        }
    }
}
View Full Code Here


           
            double a = Math.abs(bLoc.getX() - loc.getX());
            double b = Math.abs(bLoc.getZ() - loc.getZ());
            double c = Math.sqrt((a*a + b*b));
           
            p.setVelocity(v.normalize().multiply(c*0.3).setY(0.8));
        }
    }
}
View Full Code Here

        Location bLoc = boss.getEntity().getLocation();
        Location loc  = target.getLocation();
        Vector v      = new Vector(loc.getX() - bLoc.getX(), 0, loc.getZ() - bLoc.getZ());
       
        target.setVelocity(v.normalize().setY(0.8));
    }
}
View Full Code Here

       
        double a = Math.abs(bLoc.getX() - loc.getX());
        double b = Math.abs(bLoc.getZ() - loc.getZ());
        double c = Math.sqrt((a*a + b*b));
       
        target.setVelocity(v.normalize().multiply(c*0.3).setY(0.8));
    }
}
View Full Code Here

        Location bLoc = boss.getEntity().getLocation();
       
        for (Player p : AbilityUtils.getDistantPlayers(arena, boss.getEntity(), RADIUS)) {
            Location loc = p.getLocation();
            Vector v     = new Vector(loc.getX() - bLoc.getX(), 0, loc.getZ() - bLoc.getZ());
            p.setVelocity(v.normalize().setY(0.8));
        }
    }
}
View Full Code Here

        Location bLoc = boss.getEntity().getLocation();
       
        for (Player p : AbilityUtils.getNearbyPlayers(arena, boss.getEntity(), RADIUS)) {
            Location loc = p.getLocation();
            Vector v     = new Vector(loc.getX() - bLoc.getX(), 0, loc.getZ() - bLoc.getZ());
            p.setVelocity(v.normalize().setY(0.8));
        }
    }
}
View Full Code Here

  public boolean update() {
    if (--this.ticksToFinish > 0) {
      Vector dir = this.item.item.loc.offsetTo(this.getTo());
      double distancePerTick = dir.length();
      distancePerTick /= (double) this.ticksToFinish;
      dir.normalize().multiply(distancePerTick);
      this.item.update(dir);
    } else {
      return true;
    }
    return false;
View Full Code Here

      offset.setY(ParseUtil.parseDouble(offsettext[0], 0.0));
    } else {
      return def;
    }
    if (offset.length() > TrainCarts.maxEjectDistance) {
      offset.normalize().multiply(TrainCarts.maxEjectDistance);
    }
    return offset;
  }

  public static boolean parseProperties(IParsable properties, String key, String args) {
View Full Code Here

            Vector v3 = Velocity.calculate(v1, v2, gravity.asDouble(), height.asDouble());
            lastEntity.setVelocity(v3);
        }
        else if (lead == null) {
            Vector relative = destination.clone().subtract(originLocation).toVector();
            lastEntity.setVelocity(relative.normalize().multiply(speed.asDouble()));
        }
        else {
            double g = 20;
            double v = speed.asDouble();
            Vector relative = destination.clone().subtract(originLocation).toVector();
View Full Code Here

        }
        Minecart cart = blocks.rail.getWorld().spawn(location, type.toClass());
        if(minecartDispenserPropel) {
            BlockFace dir = SignUtil.getBack(blocks.sign);
            Vector vel = new Vector(dir.getModX(), dir.getModY(), dir.getModZ());
            cart.setVelocity(vel.normalize());
        }
    }

    public enum CartType {
        Minecart("Minecart", Minecart.class), StorageMinecart("Storage", StorageMinecart.class),
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.