Examples of BlockFace


Examples of org.bukkit.block.BlockFace

    addSignsFromRails(rval, railsblock);
    return rval;
  }

  public static void addSignsFromRails(List<Block> rval, Block railsBlock) {
    BlockFace dir = RailType.getType(railsBlock).getSignColumnDirection(railsBlock);
    // Has sign support at all?
    if (dir == null || dir == BlockFace.SELF) {
      return;
    }
    addSignsFromRails(rval, railsBlock, dir);
View Full Code Here

Examples of org.bukkit.block.BlockFace

      while (true) {
        // Go to the next block
        block = block.getRelative(dir);

        // Check for rails
        BlockFace columnDir = RailType.getType(block).getSignColumnDirection(block);
        if (dir == columnDir.getOppositeFace()) {
          return block;
        }

        // End of the loop?
        if (!hasSigns) {
View Full Code Here

Examples of org.bukkit.block.BlockFace

    // Unsupported/unknown Block
    return false;
  }

  public static boolean isSupported(Block block) {
    BlockFace attachedFace = BlockUtil.getAttachedFace(block);
    Block attached = block.getRelative(attachedFace);
    if (MaterialUtil.ISSIGN.get(block)) {
      // Only check the 'isBuildable' state of the Material
      Object attachedHandle = Conversion.toBlockHandle.convert(attached);
      if (attachedHandle == null) {
        return false;
      }
      Object material = blockMaterial.get(attachedHandle);
      if (material == null) {
        return false;
      }
      return materialBuildable.invoke(material);
    }
    // For all other cases, check whether the side is properly supported
    return isSupportedFace(attached, attachedFace.getOppositeFace());
  }
View Full Code Here

Examples of org.bukkit.block.BlockFace

        continue;
      }
      // Two modes: diagonal and straight
      if (diagonal) {
        // Diagonal mode
        BlockFace lastFace = null;
        int lastAngle = Integer.MAX_VALUE;
        while (iter.hasNext()) {
          iter.next();
          // Check that the direction alternates
          if (lastFace == null) {
            // Start block: store it's information
            lastFace = iter.currentDirection();
          } else {
            BlockFace newFace = iter.currentDirection();
            int newAngle = MathUtil.wrapAngle(FaceUtil.faceToYaw(newFace) - FaceUtil.faceToYaw(lastFace));
            if (Math.abs(newAngle) != 90) {
              // Not a 90-degree angle!
              break;
            }
View Full Code Here

Examples of org.bukkit.block.BlockFace

      addFuelTicks(CommonMinecartFurnace.COAL_FUEL);
    }
    if (this.isOnVertical()) {
      this.pushDirection = Util.getVerticalFace((entity.loc.getY() - EntityUtil.getLocY(human)) > 0.0);
    } else {
      BlockFace dir = FaceUtil.getRailsCartDirection(this.getRailDirection());
      if (MathUtil.isHeadingTo(dir, new Vector(entity.loc.getX() - EntityUtil.getLocX(human), 0.0, entity.loc.getZ() - EntityUtil.getLocZ(human)))) {
        this.pushDirection = dir;
      } else {
        this.pushDirection = dir.getOppositeFace();
      }
    }
    if (this.isMoving()) {
      if (this.pushDirection == this.getDirection().getOppositeFace()) {
        this.getGroup().reverse();
View Full Code Here

Examples of org.bukkit.block.BlockFace

  public void doPostMoveLogic() {
    super.doPostMoveLogic();
    if (!this.isDerailed()) {
      // Update pushing direction
      if (this.pushDirection != BlockFace.SELF) {
        BlockFace dir = this.getDirection();
        if (this.isOnVertical()) {
          if (dir != this.pushDirection.getOppositeFace()) {
            this.pushDirection = dir;
          }
        } else {
View Full Code Here

Examples of org.bukkit.block.BlockFace

    return event.isPoweredRaw(false);
  }

  public boolean handle(String[] names, SignActionEvent event) {
    for (String name : names) {
      BlockFace direction = Direction.parse(name).getDirection(event.getFacing());
      if (event.getPower(direction).hasPower()) {
        return true;
      }
    }
    return false;
View Full Code Here

Examples of org.bukkit.block.BlockFace

        }
       
        final BlockInteractConfig cc = BlockInteractConfig.getConfig(player);
        boolean cancelled = false;
       
        final BlockFace face = event.getBlockFace();
        final Location loc = player.getLocation(useLoc);
       
        // Interaction speed.
        if (!cancelled && speed.isEnabled(player) && speed.check(player, data, cc)){
          cancelled = true;
View Full Code Here

Examples of org.bukkit.block.BlockFace

      VectorHelper curVect = new VectorHelper(player, block, Common.VECTOR_BY_PLAYER,
          Common.CONSTRAIN_TO_HORIZONTAL);

//      System.out.println("Track Start at " + curVect.toString());

      BlockFace facing = curVect.getDirectionFacing();
      placeRail(blockAtVec(world, curVect), true, facing, false);

      // Place rails
      int trackLen = DigSettings.getTrackLength(player) - 1;
      int boosterDistance = DigSettings.getBoostLength(player);
View Full Code Here

Examples of org.bukkit.block.BlockFace

      vecX = (int) Math.signum(v.getX());
      vecY = (int) Math.signum(v.getY());
      vecZ = (int) Math.signum(v.getZ());

      List<Block> target = getLastTwoTargetBlocksVisible(player);
      BlockFace face = target.get(1).getFace(target.get(0));

      if (face == BlockFace.DOWN || face == BlockFace.UP) {
        vecX = 0;
        vecZ = 0;
      }
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.