Package org.bukkit.util

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


    if (getGroup().getProperties().isManualMovementAllowed() && entity.hasPassenger()) {
      Vector vel = entity.getPassenger().getVelocity();
      vel.setY(0.0);
      if (vel.lengthSquared() > 1.0E-4 && entity.vel.xz.lengthSquared() < 0.01) {
        entity.vel.xz.add(vel.multiply(0.1));
      }
    }

    // Perform any pre-movement rail updates
    getRailType().onPreMove(this);
View Full Code Here


        victor.setY(Math.tan(launchAngle) * dist);
        victor = normalizeVector(victor);
        v = v + (.5 * Math.pow(hangtime, 2));
        //Random rand = new Random(1234);
        v = v+ (CoreUtilities.getRandom().nextDouble() - .8)/2;
        victor = victor.multiply(v / 20.0);

        Projectile theHook = (Projectile) fishHook.getBukkitEntity();
        theHook.setShooter(npc.getBukkitEntity());
        theHook.setVelocity(victor);

View Full Code Here

            TNTPrimed tnt = (TNTPrimed) player.getWorld().spawnEntity(fishingCatch.getLocation(), EntityType.PRIMED_TNT);
            fishingCatch.setPassenger(tnt);

            Vector velocity = fishingCatch.getVelocity();
            double magnitude = velocity.length();
            fishingCatch.setVelocity(velocity.multiply((magnitude + 1) / magnitude));

            tnt.setMetadata(mcMMO.tntsafeMetadataKey, mcMMO.metadataValue);
            tnt.setFuseTicks(3 * Misc.TICK_CONVERSION_FACTOR);
        }
        else {
View Full Code Here

            return;

        Vector direction = event.getPlayer().getLocation().getDirection();
        direction = direction.normalize();
        direction.setY(0);
        direction = direction.multiply(event.getPlayer().getVehicle().getVelocity().length());
        direction.setY(event.getPlayer().getVehicle().getVelocity().getY());
        event.getPlayer().getVehicle().setVelocity(direction);
    }

    public int minimumSensitivity;
View Full Code Here

    public Arrow spawnArrow(Location location, Vector velocity, float speed, float spread) {
        Arrow arrow = spawn(location, Arrow.class);

        // Transformative magic
        Vector randVec = new Vector(random.nextGaussian(), random.nextGaussian(), random.nextGaussian());
        randVec.multiply(0.0075 * (double) spread);

        velocity.normalize();
        velocity.add(randVec);
        velocity.multiply(speed);

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.