Package buildcraft.core.robots

Examples of buildcraft.core.robots.EntityRobot


          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


              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

  public EntityRobot createRobot(ItemStack stack, World world) {
    try {
      NBTTagCompound nbt = NBTUtils.getItemData(stack);

      NBTTagCompound boardCpt = nbt.getCompoundTag("board");
      EntityRobot robot = new EntityRobot(world, boardCpt);

      return robot;
    } catch (Throwable e) {
      e.printStackTrace();
      return null;
View Full Code Here

    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;
              }
            }
          }
        }

        robot.overrideAI(new AIRobotGoAndLinkToDock(robot, newStation));
      }
    }
  }
View Full Code Here

      setEnergy(0);

      if (currentRecipe.canBeCrafted(this)) {
        ItemStack remaining = currentRecipe.craft(this, false).crafted.copy();

        EntityRobot robot = RobotRegistry.getRegistry(worldObj)
            .robotTaking(new ResourceIdAssemblyTable(this));

        if (robot != null) {
          remaining = robot.receiveItem(this, remaining);
        }

        if (remaining != null && remaining.stackSize > 0) {
          remaining.stackSize -= Utils
              .addToRandomInventoryAround(worldObj, xCoord, yCoord, zCoord, remaining);
View Full Code Here

    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.EntityRobot

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.