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