use of buildcraft.robotics.RobotStationPluggable in project LogisticsPipes by RS485.
the class LPBCTileGenericPipe method getBCPipePluggable.
@Override
public IBCPipePluggable getBCPipePluggable(final ForgeDirection sideHit) {
final PipePluggable plug = getPipePluggable(sideHit);
if (plug == null) {
return null;
}
return new IBCPipePluggable() {
@Override
public ItemStack[] getDropItems(LogisticsTileGenericPipe container) {
return plug.getDropItems(container);
}
@Override
public boolean isBlocking() {
return plug.isBlocking(pipe.container, sideHit);
}
@Override
public Object getOriginal() {
return plug;
}
@Override
@SideOnly(Side.CLIENT)
public void renderPluggable(RenderBlocks renderblocks, ForgeDirection dir, int renderPass, int x, int y, int z) {
if (plug.getRenderer() == null) {
return;
}
plug.getRenderer().renderPluggable(renderblocks, bcPipe, dir, plug, FakeBlock.INSTANCE, renderPass, x, y, z);
}
@Override
public boolean isAcceptingItems(LPTravelingItemServer arrivingItem) {
if (plug instanceof RobotStationPluggable) {
return true;
}
return false;
}
@Override
public LPTravelingItemServer handleItem(LPTravelingItemServer arrivingItem) {
DockingStation station = ((RobotStationPluggable) plug).getStation();
if (!station.isTaken()) {
return arrivingItem;
}
EntityRobotBase robot = station.robotTaking();
if (!(robot.getBoard() instanceof LogisticsRoutingBoardRobot)) {
return arrivingItem;
}
if (!((LogisticsRoutingBoardRobot) robot.getBoard()).isAcceptsItems()) {
return arrivingItem;
}
DoubleCoordinates robotPos = new DoubleCoordinates(robot);
if (CoordinateUtils.add(new DoubleCoordinates(LPBCTileGenericPipe.this).center(), sideHit, 0.5).distanceTo(robotPos) > 0.05) {
// Not at station
return arrivingItem;
}
return ((LogisticsRoutingBoardRobot) robot.getBoard()).handleItem(arrivingItem);
}
};
}
Aggregations