Search in sources :

Example 1 with TravelingItem

use of buildcraft.transport.TravelingItem in project LogisticsPipes by RS485.

the class BCPipeInformationProvider method acceptItem.

@Override
public boolean acceptItem(LPTravelingItem item, TileEntity from) {
    if (BlockGenericPipe.isValid(pipe.pipe) && pipe.pipe.transport instanceof PipeTransportItems) {
        TravelingItem bcItem;
        if (item instanceof LPTravelingItemServer) {
            LPRoutedBCTravelingItem lpBCItem = new LPRoutedBCTravelingItem();
            lpBCItem.setRoutingInformation(((LPTravelingItemServer) item).getInfo());
            lpBCItem.saveToExtraNBTData();
            bcItem = lpBCItem;
        } else {
            return true;
        }
        DoubleCoordinates p = new DoubleCoordinates(pipe.xCoord + 0.5F, pipe.yCoord + CoreConstants.PIPE_MIN_POS, pipe.zCoord + 0.5F);
        double move;
        if (item.output.getOpposite() == ForgeDirection.DOWN) {
            move = 0.24;
        } else if (item.output.getOpposite() == ForgeDirection.UP) {
            move = 0.74;
        } else {
            move = 0.49;
        }
        CoordinateUtils.add(p, item.output.getOpposite(), move);
        bcItem.setPosition(p.getXCoord(), p.getYCoord(), p.getZCoord());
        bcItem.setSpeed(item.getSpeed());
        if (item.getItemIdentifierStack() != null) {
            bcItem.setItemStack(item.getItemIdentifierStack().makeNormalStack());
        }
        ((PipeTransportItems) pipe.pipe.transport).injectItem(bcItem, item.output);
        return true;
    }
    return false;
}
Also used : TravelingItem(buildcraft.transport.TravelingItem) LPTravelingItem(logisticspipes.transport.LPTravelingItem) PipeTransportItems(buildcraft.transport.PipeTransportItems) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates) LPTravelingItemServer(logisticspipes.transport.LPTravelingItem.LPTravelingItemServer)

Aggregations

PipeTransportItems (buildcraft.transport.PipeTransportItems)1 TravelingItem (buildcraft.transport.TravelingItem)1 LPTravelingItem (logisticspipes.transport.LPTravelingItem)1 LPTravelingItemServer (logisticspipes.transport.LPTravelingItem.LPTravelingItemServer)1 DoubleCoordinates (network.rs485.logisticspipes.world.DoubleCoordinates)1