Search in sources :

Example 16 with DoubleCoordinates

use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.

the class HSTubeCurve method getConnectedEndTile.

@Override
public TileEntity getConnectedEndTile(ForgeDirection output) {
    TurnDirection ori = orientation.getRenderOrientation();
    if (ori.dir2 == output) {
        return container.getTile(output);
    }
    if (ori.dir1 == output) {
        DoubleCoordinates pos = new DoubleCoordinates(-2, 0, 2);
        LPPositionSet<DoubleCoordinates> set = new LPPositionSet<>(DoubleCoordinates.class);
        set.add(pos);
        orientation.rotatePositions(set);
        TileEntity subTile = pos.add(getLPPosition()).getTileEntity(getWorld());
        if (subTile instanceof LogisticsTileGenericSubMultiBlock) {
            return ((LogisticsTileGenericSubMultiBlock) subTile).getTile(output);
        }
    }
    return null;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) LPPositionSet(logisticspipes.utils.LPPositionSet) LogisticsTileGenericSubMultiBlock(logisticspipes.pipes.basic.LogisticsTileGenericSubMultiBlock) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates)

Example 17 with DoubleCoordinates

use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.

the class HSTubeLine method addCollisionBoxesToList.

@Override
public void addCollisionBoxesToList(List arraylist, AxisAlignedBB axisalignedbb) {
    DoubleCoordinates pos = getLPPosition();
    LPPositionSet<DoubleCoordinates> set = new LPPositionSet<>(DoubleCoordinates.class);
    set.addFrom(LineTubeRenderer.tubeLine.get(orientation.getRenderOrientation()).bounds().toAABB());
    set.stream().forEach(o -> o.add(pos));
    AxisAlignedBB box = set.toABB();
    if (box != null && (axisalignedbb == null || axisalignedbb.intersectsWith(box))) {
        arraylist.add(box);
    }
}
Also used : AxisAlignedBB(net.minecraft.util.AxisAlignedBB) LPPositionSet(logisticspipes.utils.LPPositionSet) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates)

Example 18 with DoubleCoordinates

use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.

the class LogisticsRoutingBoardRobot method index.

private void index() {
    if (init) {
        return;
    }
    DockingStation dock = robot.getLinkedStation();
    if (dock == null) {
        return;
    }
    DoubleCoordinates pos = new DoubleCoordinates(dock.x(), dock.y(), dock.z());
    LPRobotConnectionControl.instance.addRobot(robot.worldObj, pos, dock.side());
    init = true;
}
Also used : DockingStation(buildcraft.api.robots.DockingStation) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates)

Example 19 with DoubleCoordinates

use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.

the class HSTubeSpeedup method getConnectedEndTile.

@Override
public TileEntity getConnectedEndTile(ForgeDirection output) {
    if (orientation.dir1 == output) {
        DoubleCoordinates pos = new DoubleCoordinates(0, 0, -3);
        LPPositionSet<DoubleCoordinates> set = new LPPositionSet<>(DoubleCoordinates.class);
        set.add(pos);
        orientation.rotatePositions(set);
        TileEntity subTile = pos.add(getLPPosition()).getTileEntity(getWorld());
        if (subTile instanceof LogisticsTileGenericSubMultiBlock) {
            return ((LogisticsTileGenericSubMultiBlock) subTile).getTile(output);
        }
    } else if (orientation.dir1.getOpposite() == output) {
        return container.getTile(output);
    }
    return null;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) LPPositionSet(logisticspipes.utils.LPPositionSet) LogisticsTileGenericSubMultiBlock(logisticspipes.pipes.basic.LogisticsTileGenericSubMultiBlock) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates)

Example 20 with DoubleCoordinates

use of network.rs485.logisticspipes.world.DoubleCoordinates 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

DoubleCoordinates (network.rs485.logisticspipes.world.DoubleCoordinates)70 TileEntity (net.minecraft.tileentity.TileEntity)44 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)21 LogisticsTileGenericPipe (logisticspipes.pipes.basic.LogisticsTileGenericPipe)15 ArrayList (java.util.ArrayList)14 LPPositionSet (logisticspipes.utils.LPPositionSet)10 Block (net.minecraft.block.Block)10 SideOnly (cpw.mods.fml.relauncher.SideOnly)8 CoreRoutedPipe (logisticspipes.pipes.basic.CoreRoutedPipe)8 ItemStack (net.minecraft.item.ItemStack)8 World (net.minecraft.world.World)8 LogisticsTileGenericSubMultiBlock (logisticspipes.pipes.basic.LogisticsTileGenericSubMultiBlock)6 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)6 IIcon (net.minecraft.util.IIcon)6 DockingStation (buildcraft.api.robots.DockingStation)5 MovingObjectPosition (net.minecraft.util.MovingObjectPosition)5 DoubleCoordinatesType (network.rs485.logisticspipes.world.DoubleCoordinatesType)5 EntityRobotBase (buildcraft.api.robots.EntityRobotBase)4 PipePluggable (buildcraft.api.transport.pluggable.PipePluggable)4 RobotStationPluggable (buildcraft.robotics.RobotStationPluggable)4