Examples of RailType


Examples of com.bergerkiller.bukkit.tc.rails.type.RailType

    } else if (BlockUtil.equals(rail1, rail2)) {
      return true;
    }

    // Use rail types to find out the directions to look
    RailType rail1type = RailType.getType(rail1);
    RailType rail2type = RailType.getType(rail2);
    if (rail1type == RailType.NONE || rail2type == RailType.NONE) {
      return false;
    }
    BlockFace[] rail1dirs = rail1type.getPossibleDirections(rail1);
    BlockFace[] rail2dirs = rail2type.getPossibleDirections(rail2);
    if (rail1dirs.length == 0 || rail2dirs.length == 0) {
      return false;
    }

    // Figure out where a Minecart is located on this Rail
View Full Code Here

Examples of com.bergerkiller.bukkit.tc.rails.type.RailType

  private void addPendingNodes() {
    if (!this.pendingNodes.isEmpty()) {
      for (PathNode node : this.pendingNodes) {
        Block startRail = node.location.getBlock();
        RailType startType = RailType.getType(startRail);
        if (startType == RailType.NONE) {
          // Track type can not be identified
          continue;
        }
        if (node.containsSwitcher()) {
          if (DEBUG_MODE) {
            System.out.println("NODE " + node.getDisplayName() + " CONTAINS A SWITCHER");
          }
          // Check north-east-south-west for possible routes
          for (BlockFace dir : FaceUtil.AXIS) {
            scheduleNode(node, startType.findMinecartPos(startRail).getRelative(dir), dir);
          }
        } else {
          // Only check available routes
          for (BlockFace dir : startType.getPossibleDirections(startRail)) {
            scheduleNode(node, startType.getNextPos(startRail, dir), dir);
          }
        }
      }
      this.pendingNodes.clear();
    }
View Full Code Here

Examples of com.bergerkiller.bukkit.tc.rails.type.RailType

   *
   * @return Center location
   */
  public Location getCenterLocation() {
    if (!this.hasRails()) return null;
    RailType type = RailType.getType(this.railsblock);
    return type.findMinecartPos(this.railsblock).getLocation().add(0.5, 0.5, 0.5);
  }
View Full Code Here

Examples of com.bergerkiller.bukkit.tc.rails.type.RailType

  public boolean isConnectedRails(BlockFace direction) {
    if (!this.hasRails()) {
      return false;
    }
    // Get the next minecart Block position
    RailType currentType = RailType.getType(getRails());
    if (!LogicUtil.contains(direction, currentType.getPossibleDirections(getRails()))) {
      return false;
    }
    Block posBlock = currentType.getNextPos(getRails(), direction);
    if (posBlock == null) {
      return false;
    }
    for (RailType type : RailType.values()) {
      Block railsBlock = type.findRail(posBlock);
View Full Code Here

Examples of com.bergerkiller.bukkit.tc.rails.type.RailType

   * @param direction to look into, use SELF to check all possible directions
   * @return straight length
   */
  public static double calculateStraightLength(Block railsBlock, BlockFace direction) {
    // Read track information and parameters
    RailType type = RailType.getType(railsBlock);
    boolean diagonal = FaceUtil.isSubCardinal(type.getDirection(railsBlock));
    final BlockFace[] toCheck;
    if (direction == BlockFace.SELF) {
      toCheck = type.getPossibleDirections(railsBlock);
    } else {
      toCheck = new BlockFace[] {direction};
    }
    double length = 0.0;
    TrackIterator iter = new TrackIterator(null, null, 20, false);
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.