Package buildcraft.core.robots

Examples of buildcraft.core.robots.DockingStation


    for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
      IPipePluggable pluggable = sideProperties.pluggables[direction.ordinal()];
      bcRenderState.plugMatrix.setConnected(direction, pluggable instanceof ItemPlug.PlugPluggable);

      if (pluggable instanceof ItemRobotStation.RobotStationPluggable) {
        DockingStation station = ((ItemRobotStation.RobotStationPluggable) pluggable).getStation();

        if (station.isTaken()) {
          if (station.isMainStation()) {
            bcRenderState.robotStationMatrix.setState(direction, RobotStationState.Linked);
          } else {
            bcRenderState.robotStationMatrix.setState(direction, RobotStationState.Reserved);
          }
        } else {
View Full Code Here


    } else if(currentItem.getItem() instanceof ItemRobot) {
      if(!world.isRemote) {
        RaytraceResult rayTraceResult = block.doRayTrace(world, x, y, z, player);
       
        if (rayTraceResult != null && rayTraceResult.hitPart == Part.RobotStation) {
          DockingStation station = (DockingStation) pipe.container.tilePart.getStation(rayTraceResult.sideHit);

          if (!station.isTaken()) {
            if(ItemRobot.getRobotNBT(currentItem) == null) { return true; }
            RobotPlacementEvent robotEvent = new RobotPlacementEvent(player, ((NBTTagCompound)currentItem.stackTagCompound.getTag("board")).getString("id"));
            FMLCommonHandler.instance().bus().post(robotEvent);
            if(robotEvent.isCanceled()) { return true; }
            EntityRobot robot = ((ItemRobot)currentItem.getItem()).createRobot(currentItem, world);
           
            if(robot != null && robot.getRegistry() != null) {
              robot.setUniqueRobotId(robot.getRegistry().getNextRobotId());
              robot.getBattery().setEnergy(EntityRobotBase.MAX_ENERGY);
             
              float px = x + 0.5F + rayTraceResult.sideHit.offsetX * 0.5F;
              float py = y + 0.5F + rayTraceResult.sideHit.offsetY * 0.5F;
              float pz = z + 0.5F + rayTraceResult.sideHit.offsetZ * 0.5F;
             
              robot.setPosition(px, py, pz);
              station.takeAsMain(robot);
              robot.dock(robot.getLinkedStation());
              world.spawnEntityInWorld(robot);
             
              if(!player.capabilities.isCreativeMode) {
                player.getCurrentEquippedItem().stackSize--;
View Full Code Here

        if (!world.isRemote) {
          RaytraceResult rayTraceResult = doRayTrace(world, x, y, z,
              player);

          if (rayTraceResult != null && rayTraceResult.hitPart == Part.RobotStation) {
            DockingStation station = pipe.container.getStation(rayTraceResult.sideHit);

            if (!station.isTaken()) {
              if (ItemRobot.getRobotNBT(currentItem) == null) {
                return true;
              }
              RobotPlacementEvent robotEvent = new RobotPlacementEvent(player, ((NBTTagCompound) currentItem.stackTagCompound.getTag("board")).getString("id"));
              FMLCommonHandler.instance().bus().post(robotEvent);
              if (robotEvent.isCanceled()) {
                return true;
              }
              EntityRobot robot = ((ItemRobot) currentItem.getItem())
                  .createRobot(currentItem, world);
             
              if (robot != null && robot.getRegistry() != null) {
                robot.setUniqueRobotId(robot.getRegistry().getNextRobotId());
                robot.getBattery().setEnergy(EntityRobotBase.MAX_ENERGY);
 
                float px = x + 0.5F + rayTraceResult.sideHit.offsetX * 0.5F;
                float py = y + 0.5F + rayTraceResult.sideHit.offsetY * 0.5F;
                float pz = z + 0.5F + rayTraceResult.sideHit.offsetZ * 0.5F;
 
                robot.setPosition(px, py, pz);
                station.takeAsMain(robot);
                robot.dock(robot.getLinkedStation());
                world.spawnEntityInWorld(robot);
 
                if (!player.capabilities.isCreativeMode) {
                  player.getCurrentEquippedItem().stackSize--;
View Full Code Here

            gPipe.yCoord,
            gPipe.zCoord,
            direction);

        if (station == null) {
          station = new DockingStation(gPipe, direction);
          RobotRegistry.getRegistry(gPipe.getWorld()).registerStation(station);
        }

        isValid = true;
      }
View Full Code Here

  public void actionActivate(IStatementContainer container, IStatementParameter[] parameters) {
    Pipe<?> pipe = ((Gate) container).pipe;
    RobotRegistry registry = RobotRegistry.getRegistry(pipe.getWorld());

    for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
      DockingStation station = pipe.container.getStation(d);

      if (station != null && station.robotTaking() != null) {
        EntityRobot robot = (EntityRobot) station.robotTaking();
        AIRobot ai = robot.getOverridingAI();

        if (ai != null) {
          continue;
        }

        DockingStation newStation = station;

        if (parameters[0] != null) {
          StatementParameterItemStack stackParam = (StatementParameterItemStack) parameters[0];
          ItemStack item = stackParam.getItemStack();

          if (item != null && item.getItem() instanceof ItemMapLocation) {
            BlockIndex index = ItemMapLocation.getBlockIndex(item);

            if (index != null) {
              ForgeDirection side = ItemMapLocation.getSide(item);
              DockingStation paramStation = (DockingStation)
                  registry.getStation(index.x,
                  index.y, index.z, side);

              if (paramStation != null) {
                newStation = paramStation;
View Full Code Here

  }

  public void updateFilter() {
    fluidFilter.clear();

    DockingStation station = (DockingStation) robot.getLinkedStation();

    for (StatementSlot slot : new ActionIterator(station.getPipe().pipe)) {
      if (slot.statement instanceof ActionRobotFilter) {
        for (IStatementParameter p : slot.parameters) {
          if (p != null && p instanceof StatementParameterItemStack) {
            StatementParameterItemStack param = (StatementParameterItemStack) p;
            ItemStack stack = param.getItemStack();
View Full Code Here

    for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
      IPipePluggable pluggable = sideProperties.pluggables[direction.ordinal()];
      renderState.plugMatrix.setConnected(direction, pluggable instanceof ItemPlug.PlugPluggable);

      if (pluggable instanceof ItemRobotStation.RobotStationPluggable) {
        DockingStation station = ((ItemRobotStation.RobotStationPluggable) pluggable).getStation();

        if (station.isTaken()) {
          if (station.isMainStation()) {
            renderState.robotStationMatrix.setState(direction,
              RobotStationState.Linked);
          } else {
            renderState.robotStationMatrix.setState(direction,
                RobotStationState.Reserved);
View Full Code Here

  public final void updateFilter() {
    blockFilter.clear();
    metaFilter.clear();

    DockingStation station = (DockingStation) robot.getLinkedStation();

    for (StatementSlot slot : new ActionIterator(station.getPipe().pipe)) {
      if (slot.statement instanceof ActionRobotFilter) {
        for (IStatementParameter p : slot.parameters) {
          if (p != null && p instanceof StatementParameterItemStack) {
            StatementParameterItemStack param = (StatementParameterItemStack) p;
            ItemStack stack = param.getItemStack();
View Full Code Here

   
    Pipe<?> pipe = (Pipe<?>) ((IGate) container).getPipe();
    TileGenericPipe tile = pipe.container;

    for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
      DockingStation station = tile.getStation(d);

      if (station != null && station.robotTaking() != null) {
        EntityRobot robot = (EntityRobot) station.robotTaking();

        if (robot.mainAI.getActiveAI() instanceof AIRobotSleep) {
          return true;
        }
      }
View Full Code Here

TOP

Related Classes of buildcraft.core.robots.DockingStation

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.