org.bukkit.util.Vector#getY ( )源码实例Demo

下面列出了org.bukkit.util.Vector#getY ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: HoloAPI   文件: HologramImpl.java
@Override
public void move(Vector to) {
    checkNotNull(to, "The Vector object in HologramImpl#move(Vector) is null");
    this.defX = to.getX();
    this.defY = to.getY();
    this.defZ = to.getZ();
    if (!this.isSimple()) {
        HoloAPI.getManager().saveToFile(this);
    }
    for (String ident : this.getPlayerViews().keySet()) {
        Player p = IdentUtil.getPlayerOf(ident);
        if (p != null) {
            this.move(p, to);
        }
    }
}
 
源代码2 项目: EntityAPI   文件: ControllableMushroomCowEntity.java
@Override
public void g(double x, double y, double z) {
    if (this.controllableEntity != null) {
        Vector velocity = this.controllableEntity.getMind().getAttribute(PushAttribute.class).call(this.controllableEntity, new Vector(x, y, z)).getPushVelocity();
        x = velocity.getX();
        y = velocity.getY();
        z = velocity.getZ();
    }
    super.g(x, y, z);
}
 
源代码3 项目: EntityAPI   文件: ControllableSlimeEntity.java
@Override
public void g(double x, double y, double z) {
    if (this.controllableEntity != null) {
        Vector velocity = this.controllableEntity.getMind().getAttribute(PushAttribute.class).call(this.controllableEntity, new Vector(x, y, z)).getPushVelocity();
        x = velocity.getX();
        y = velocity.getY();
        z = velocity.getZ();
    }
    super.g(x, y, z);
}
 
源代码4 项目: EntityAPI   文件: ControllableIronGolemEntity.java
@Override
public void g(double x, double y, double z) {
    if (this.controllableEntity != null) {
        Vector velocity = this.controllableEntity.getMind().getAttribute(PushAttribute.class).call(this.controllableEntity, new Vector(x, y, z)).getPushVelocity();
        x = velocity.getX();
        y = velocity.getY();
        z = velocity.getZ();
    }
    super.g(x, y, z);
}
 
源代码5 项目: PGM   文件: BlockVectors.java
static boolean isInside(Vector point, Location blockLocation) {
  return blockLocation.getX() <= point.getX()
      && point.getX() <= blockLocation.getX() + 1
      && blockLocation.getY() <= point.getY()
      && point.getY() <= blockLocation.getY() + 1
      && blockLocation.getZ() <= point.getZ()
      && point.getZ() <= blockLocation.getZ() + 1;
}
 
源代码6 项目: EntityAPI   文件: ControllableSilverfishEntity.java
@Override
public void g(double x, double y, double z) {
    if (this.controllableEntity != null) {
        Vector velocity = this.controllableEntity.getMind().getAttribute(PushAttribute.class).call(this.controllableEntity, new Vector(x, y, z)).getPushVelocity();
        x = velocity.getX();
        y = velocity.getY();
        z = velocity.getZ();
    }
    super.g(x, y, z);
}
 
源代码7 项目: EntityAPI   文件: ControllableBatEntity.java
@Override
public void g(double x, double y, double z) {
    if (this.controllableEntity != null) {
        Vector velocity = this.controllableEntity.getMind().getAttribute(PushAttribute.class).call(this.controllableEntity, new Vector(x, y, z)).getPushVelocity();
        x = velocity.getX();
        y = velocity.getY();
        z = velocity.getZ();
    }
    super.g(x, y, z);
}
 
源代码8 项目: EntityAPI   文件: ControllableBlazeEntity.java
@Override
public void g(double x, double y, double z) {
    if (this.controllableEntity != null) {
        Vector velocity = this.controllableEntity.getMind().getAttribute(PushAttribute.class).call(this.controllableEntity, new Vector(x, y, z)).getPushVelocity();
        x = velocity.getX();
        y = velocity.getY();
        z = velocity.getZ();
    }
    super.g(x, y, z);
}
 
源代码9 项目: EffectLib   文件: TraceEffect.java
@Override
public void onRun() {
    Location location = getLocation();
    if (world == null) {
        world = location.getWorld();
    } else if (!location.getWorld().equals(world)) {
        cancel(true);
        return;
    }

    synchronized(wayPoints)
    {
        if (wayPoints.size() >= maxWayPoints) {
            wayPoints.remove(0);
        }
    }

    wayPoints.add(location.toVector());
    step++;
    if (step % refresh != 0) {
        return;
    }

    synchronized(wayPoints)
    {
        for (Vector position : wayPoints) {
            Location particleLocation = new Location(world, position.getX(), position.getY(), position.getZ());
            display(particle, particleLocation);
        }
    }
}
 
源代码10 项目: Chimera   文件: Vectors.java
public static Vector rotateAroundXAxis(Vector vector, double angle) {
    double cos = cos(angle);
    double sin = sin(angle);
    double y = vector.getY() * cos - vector.getZ() * sin;
    double z = vector.getY() * sin + vector.getZ() * cos;
    
    return vector.setY(y).setZ(z);
}
 
源代码11 项目: EntityAPI   文件: ControllableEnderDragonEntity.java
@Override
public void g(double x, double y, double z) {
    if (this.controllableEntity != null) {
        Vector velocity = this.controllableEntity.getMind().getAttribute(PushAttribute.class).call(this.controllableEntity, new Vector(x, y, z)).getPushVelocity();
        x = velocity.getX();
        y = velocity.getY();
        z = velocity.getZ();
    }
    super.g(x, y, z);
}
 
源代码12 项目: EntityAPI   文件: ControllableOcelotEntity.java
@Override
public void g(double x, double y, double z) {
    if (this.controllableEntity != null) {
        Vector velocity = this.controllableEntity.getMind().getAttribute(PushAttribute.class).call(this.controllableEntity, new Vector(x, y, z)).getPushVelocity();
        x = velocity.getX();
        y = velocity.getY();
        z = velocity.getZ();
    }
    super.g(x, y, z);
}
 
源代码13 项目: EntityAPI   文件: ControllablePigEntity.java
@Override
public void g(double x, double y, double z) {
    if (this.controllableEntity != null) {
        Vector velocity = this.controllableEntity.getMind().getAttribute(PushAttribute.class).call(this.controllableEntity, new Vector(x, y, z)).getPushVelocity();
        x = velocity.getX();
        y = velocity.getY();
        z = velocity.getZ();
    }
    super.g(x, y, z);
}
 
源代码14 项目: Thermos   文件: CraftFireball.java
public void setDirection(Vector direction) {
    Validate.notNull(direction, "Direction can not be null");
    double x = direction.getX();
    double y = direction.getY();
    double z = direction.getZ();
    double magnitude = (double) MathHelper.sqrt_double(x * x + y * y + z * z);
    getHandle().accelerationX = x / magnitude;
    getHandle().accelerationY = y / magnitude;
    getHandle().accelerationZ = z / magnitude;
}
 
源代码15 项目: EchoPet   文件: EntityPet.java
public void setVelocity(Vector vel) {
    this.motX = vel.getX();
    this.motY = vel.getY();
    this.motZ = vel.getZ();
    this.velocityChanged = true;
}
 
源代码16 项目: EchoPet   文件: EntityPet.java
public void onLive() {
    if (this.pet == null) {
        this.remove(false);
        return;
    }

    if (this.getPlayerOwner() == null || !this.getPlayerOwner().isOnline() || Bukkit.getPlayerExact(this.getPlayerOwner().getName()) == null) {
        EchoPet.getManager().removePet(this.getPet(), true);
        return;
    }

    if (pet.isOwnerRiding() && this.passenger == null && !pet.isOwnerInMountingProcess()) {
        pet.ownerRidePet(false);
    }

    if (((CraftPlayer) this.getPlayerOwner()).getHandle().isInvisible() != this.isInvisible() && !this.shouldVanish) {
        this.setInvisible(!this.isInvisible());
    }

    if (((CraftPlayer) this.getPlayerOwner()).getHandle().isSneaking() != this.isSneaking()) {
        this.setSneaking(!this.isSneaking());
    }

    if (((CraftPlayer) this.getPlayerOwner()).getHandle().isSprinting() != this.isSprinting()) {
        this.setSprinting(!this.isSprinting());
    }

    if (this.getPet().isHat()) {

        this.lastYaw = this.yaw = (this.getPet().getPetType() == PetType.ENDERDRAGON ? this.getPlayerOwner().getLocation().getYaw() - 180 : this.getPlayerOwner().getLocation().getYaw());
    }

    if (this.getPlayerOwner().isFlying() && EchoPet.getOptions().canFly(this.getPet().getPetType())) {
        Location petLoc = this.getLocation();
        Location ownerLoc = this.getPlayerOwner().getLocation();
        Vector v = ownerLoc.toVector().subtract(petLoc.toVector());

        double x = v.getX();
        double y = v.getY();
        double z = v.getZ();

        Vector vo = this.getPlayerOwner().getLocation().getDirection();
        if (vo.getX() > 0) {
            x -= 1.5;
        } else if (vo.getX() < 0) {
            x += 1.5;
        }
        if (vo.getZ() > 0) {
            z -= 1.5;
        } else if (vo.getZ() < 0) {
            z += 1.5;
        }

        this.setVelocity(new Vector(x, y, z).normalize().multiply(0.3F));
    }
}
 
源代码17 项目: SonarPet   文件: EntityInsentientPet.java
public void onLive() {
    if (this.getPet() == null) {
        this.remove(false);
        return;
    }

    if (this.getPlayerOwner() == null || !this.getPlayerOwner().isOnline()) {
        EchoPet.getManager().removePet(this.getPet(), true);
        return;
    }

    if (getPet().isOwnerRiding() && getEntity().getPassengers().isEmpty() && !getPet().isOwnerInMountingProcess()) {
        getPet().ownerRidePet(false);
    }

    if (getPlayerEntity().isInvisible() != getEntity().isInvisible() && !shouldVanish) {
        getEntity().setInvisible(!getEntity().isInvisible());
    }

    if (getPlayerEntity().isSneaking() != getEntity().isSneaking()) {
        getEntity().setSneaking(!getEntity().isSneaking());
    }

    if (getPlayerEntity().isSprinting() != getEntity().isSprinting()) {
        getEntity().setSprinting(!getEntity().isSprinting());
    }

    if (this.getPet().isHat()) {
        getEntity().setYaw(this.getPet().getPetType() == PetType.ENDERDRAGON ? this.getPlayerOwner().getLocation().getYaw() - 180 : this.getPlayerOwner().getLocation().getYaw());
    }

    if (this.getPlayerOwner().isFlying() && EchoPet.getOptions().canFly(this.getPet().getPetType())) {
        Location petLoc = this.getLocation();
        Location ownerLoc = this.getPlayerOwner().getLocation();
        Vector v = ownerLoc.toVector().subtract(petLoc.toVector());

        double x = v.getX();
        double y = v.getY();
        double z = v.getZ();

        Vector vo = this.getPlayerOwner().getLocation().getDirection();
        if (vo.getX() > 0) {
            x -= 1.5;
        } else if (vo.getX() < 0) {
            x += 1.5;
        }
        if (vo.getZ() > 0) {
            z -= 1.5;
        } else if (vo.getZ() < 0) {
            z += 1.5;
        }

        getBukkitEntity().setVelocity(new Vector(x, y, z).normalize().multiply(0.3F));
    }
    ImmutableSet<NMSEntity> passengers = ImmutableSet.copyOf(getEntity().getPassengers());
    if (passengers.isEmpty()) {
        petGoalSelector.updateGoals();
    }
    // Check for mounts
    for (NMSEntity passenger : passengers) {
        if (!knownMountedEntities.contains(passenger)) {
            onMounted(passenger);
            knownMountedEntities.add(passenger);
        }
    }
    // Check for dismounts
    knownMountedEntities.removeIf((entity) -> {
        if (!passengers.contains(entity)) {
            onDismounted(entity);
            return true;
        }
        return false;
    });
}
 
源代码18 项目: Skript   文件: ExprVectorXYZ.java
@Override
public Number convert(Vector v) {
	return axis == 0 ? v.getX() : (axis == 1 ? v.getY() : v.getZ());
}
 
源代码19 项目: AACAdditionPro   文件: TowerBlockPlace.java
/**
 * Calculates the time needed to place one block.
 */
private static double calculateDelay(Integer jumpBoostLevel, Integer levitationLevel)
{
    if (levitationLevel != null) {
        // 0.9 Blocks per second per levitation level.
        return 900 / ((levitationLevel + 1D) * TOWER_LENIENCY * LEVITATION_LENIENCY);
    }

    // No JUMP_BOOST
    if (jumpBoostLevel == null) {
        return AMPLIFIER_CACHE.get(0);
    }

    // Player has JUMP_BOOST
    if (jumpBoostLevel < 0) {
        // Negative JUMP_BOOST -> Not allowed to place blocks -> Very high delay
        return 1500;
    }

    if (jumpBoostLevel + 1 < AMPLIFIER_CACHE.size()) {
        return AMPLIFIER_CACHE.get(jumpBoostLevel + 1);
    }

    // The velocity in the beginning
    Vector currentVelocity = new Vector(0, Jumping.getJumpYMotion(jumpBoostLevel), 0);

    // The first tick (1) happens here
    double currentBlockValue = currentVelocity.getY();

    // Start the tick-loop at 2 due to the one tick outside.
    for (short ticks = 2; ticks < 160; ticks++) {
        currentVelocity = Gravitation.applyGravitationAndAirResistance(currentVelocity, Gravitation.PLAYER);

        // Break as the player has already reached the max height (no more blocks to place below).
        if (currentVelocity.getY() <= 0) {
            // If the result is lower here, the detection is more lenient.
            // * 50 : Convert ticks to milliseconds
            // 0.925 is additional leniency
            // Deliberately ignore the "falling" phase above the last block to increase leniency and code simplicity
            return ((ticks * 50) / Math.floor(currentBlockValue)) * 0.925 * TOWER_LENIENCY;
        }

        currentBlockValue += currentVelocity.getY();
    }

    // Too high movement; no checking
    return 0;
}
 
源代码20 项目: AACAdditionPro   文件: AxisAlignedBB.java
/**
 * Check if the given Vector lies within this Bounding Box
 *
 * @param vector the vector which may or may not be in this Bounding Box
 *
 * @return true when the vector is inside this Bounding Box, false when not
 */
public boolean isVectorInside(Vector vector)
{
    return !(vector.getX() <= this.minX || vector.getX() >= this.maxX) &&
           !(vector.getY() <= this.minY || vector.getY() >= this.maxY) &&
           (vector.getZ() > this.minZ || vector.getZ() < this.maxZ);
}