Package com.bergerkiller.bukkit.tc

Examples of com.bergerkiller.bukkit.tc.Station


    if (!info.hasRails() || !info.hasGroup() || info.getGroup().isEmpty()) {
      return;
    }
    //Check if not already targeting
    MinecartGroup group = info.getGroup();
    Station station = new Station(info);
    if (!station.isValid()) {
      return;
    }

    //What do we do?
    if (station.getInstruction() == null) {
      // Clear actions, but only if requested to do so because of a redstone change
      if (info.isAction(SignActionType.REDSTONE_CHANGE)) {
        info.getGroup().getActions().clear();
      }
    } else if (station.getInstruction() == BlockFace.SELF) {
      MinecartMember<?> centerMember = station.getCenterCart();
      // Do not allow redstone changes to center a launching train
      if (info.isAction(SignActionType.REDSTONE_CHANGE) && (centerMember.isMovementControlled() || info.getGroup().isMoving())) {
        return;
      }

      //Brake
      //TODO: ADD CHECK?!
      group.getActions().clear();   
      BlockFace trainDirection = station.getNextDirection().getDirection(info.getFacing(), info.getMember().getDirection());
      if (station.getNextDirection() != Direction.NONE) {
        // Actual launching here
        if (station.hasDelay()) {
          station.centerTrain();
          station.waitTrain(station.getDelay());
        } else if (!info.getMember().isDirectionTo(trainDirection)) {
          // Order the train to center prior to launching again
          station.centerTrain();
        }
        station.launchTo(trainDirection, station.getLength());
      } else {
        station.centerTrain();
        station.waitTrain(Long.MAX_VALUE);
      }
    } else {
      //Launch
      group.getActions().clear();
      MinecartMember<?> head = group.head();

      if (station.hasDelay() || (head.isMoving() && !info.getMember().isDirectionTo(station.getInstruction()))) {
        //Reversing or has delay, need to center it in the middle first
        station.centerTrain();
      }
      if (station.hasDelay()) {
        station.waitTrain(station.getDelay());
      }
      station.launchTo(station.getInstruction(), station.getLength());
    }
  }
View Full Code Here

TOP

Related Classes of com.bergerkiller.bukkit.tc.Station

Copyright © 2018 www.massapicom. 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.