Package buildcraft.transport

Examples of buildcraft.transport.TravelingItem


 
  public boolean insertIntoBuildcraftPipe(TileEntity tile, LPTravelingItem item) {
    if(tile instanceof TileGenericPipe) {
      TileGenericPipe pipe = (TileGenericPipe)tile;
      if(BlockGenericPipe.isValid(pipe.pipe) && pipe.pipe.transport instanceof PipeTransportItems) {
        TravelingItem bcItem = null;
        if(item instanceof LPTravelingItemServer) {
          LPRoutedBCTravelingItem lpBCItem = new LPRoutedBCTravelingItem();
          lpBCItem.setRoutingInformation(((LPTravelingItemServer)item).getInfo());
          lpBCItem.saveToExtraNBTData();
          bcItem = lpBCItem;
        } else {
          //TODO is this needed ClientSide ?
          //bcItem = TravelingItem.make();
          return true;
        }
        LPPosition p = new LPPosition(tile.xCoord + 0.5F, tile.yCoord + CoreConstants.PIPE_MIN_POS, tile.zCoord + 0.5F);
        if(item.output.getOpposite() == ForgeDirection.DOWN) {
          p.moveForward(item.output.getOpposite(), 0.24F);
        } else if(item.output.getOpposite() == ForgeDirection.UP) {
          p.moveForward(item.output.getOpposite(), 0.74F);
        } else {
          p.moveForward(item.output.getOpposite(), 0.49F);
        }
        bcItem.setPosition(p.getXD(), p.getYD(), p.getZD());
        bcItem.setSpeed(item.getSpeed());
        if(item.getItemIdentifierStack() != null) {
          bcItem.setItemStack(item.getItemIdentifierStack().makeNormalStack());
        }
        ((PipeTransportItems)pipe.pipe.transport).injectItem(bcItem, item.output);
        return true;
      }
    }
View Full Code Here


        Position entityPos = new Position(tile.xCoord + 0.5, tile.yCoord + 0.5, tile.zCoord + 0.5, side.getOpposite());

        entityPos.moveForwards(0.6);

        TravelingItem entity = makeItem(entityPos.x, entityPos.y, entityPos.z, stack);

        transport.injectItem(entity, entityPos.orientation);
      }
    }
  }
View Full Code Here

    return PipeIconProvider.TYPE.PipeItemsQuartz.ordinal();
  }

  public void eventHandler(PipeEventItem.AdjustSpeed event) {
    event.handled = true;
    TravelingItem item = event.item;

    if (item.getSpeed() > TransportConstants.PIPE_NORMAL_SPEED) {
      item.setSpeed(item.getSpeed() - TransportConstants.PIPE_NORMAL_SPEED / 4.0F);
    }

    if (item.getSpeed() < TransportConstants.PIPE_NORMAL_SPEED) {
      item.setSpeed(TransportConstants.PIPE_NORMAL_SPEED);
    }
  }
View Full Code Here

    return true;
  }

  @Override
  protected TravelingItem makeItem(double x, double y, double z, ItemStack stack) {
    TravelingItem item = super.makeItem(x, y, z, stack);
    int color = slotColors[currentFilter % filterCount];
    if (color > 0) {
      item.color = EnumColor.fromId(color - 1);
    }
    return item;
View Full Code Here

      this.container.glassColor = stack.getItemDamage() - 1;
     
      if (stack.stackSize > 0) {
        TileEntity targetTile = getWorld().getTileEntity((int) p.x, (int) p.y, (int) p.z);
        if (targetTile instanceof TileGenericPipe) {
          TravelingItem newItem = TravelingItem.make(
              container.xCoord + 0.5,
              container.yCoord + TransportUtils.getPipeFloorOf(
                  new ItemStack(BuildCraftTransport.pipeItemsStripes)),
              container.zCoord + 0.5, stack.copy());
          ((PipeTransportItems) ((TileGenericPipe) targetTile).pipe.transport).injectItem(newItem, event.direction.getOpposite());
View Full Code Here

        0.0f);
  }
 
  @Override
  public void sendItem(ItemStack itemStack, ForgeDirection direction) {
    TravelingItem newItem = TravelingItem.make(
        container.xCoord + 0.5,
        container.yCoord + TransportUtils.getPipeFloorOf(itemStack),
        container.zCoord + 0.5, itemStack);
    transport.injectItem(newItem, direction);
  }
View Full Code Here

    event.item.color = getColor();
  }

  public void eventHandler(PipeEventItem.AdjustSpeed event) {
    event.handled = true;
    TravelingItem item = event.item;

    if (item.getSpeed() > TransportConstants.PIPE_NORMAL_SPEED) {
      item.setSpeed(item.getSpeed() - TransportConstants.PIPE_NORMAL_SPEED / 4.0F);
    }

    if (item.getSpeed() < TransportConstants.PIPE_NORMAL_SPEED) {
      item.setSpeed(TransportConstants.PIPE_NORMAL_SPEED);
    }
  }
View Full Code Here

  @Override
  public void readData(ByteBuf data) {
    this.entityId = data.readInt();
    stack = Utils.readStack(data);
    TravelingItem item = TravelingItem.clientCache.get(entityId);
    if (item != null) {
      item.setItemStack(stack);
    }
  }
View Full Code Here

      if (stack == null) {
        return;
      }
     
      TravelingItem item = TravelingItem.make(container.xCoord + 0.5, container.yCoord + TransportUtils.getPipeFloorOf(stack), container.zCoord + 0.5, stack);

      item.setSpeed((float) speed);

      transport.injectItem(item, orientation);
    }
  }
View Full Code Here

    if (station.getPipe().pipe.transport instanceof PipeTransportItems) {
      float cx = station.x() + 0.5F + 0.2F * station.side().offsetX;
      float cy = station.y() + 0.5F + 0.2F * station.side().offsetY;
      float cz = station.z() + 0.5F + 0.2F * station.side().offsetZ;

      TravelingItem item = TravelingItem.make(cx, cy, cz, invSlot.getStackInSlot());

      ((PipeTransportItems) station.getPipe().pipe.transport).injectItem(item, station.side().getOpposite());

      invSlot.setStackInSlot(null);

View Full Code Here

TOP

Related Classes of buildcraft.transport.TravelingItem

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.