Search in sources :

Example 46 with DoubleCoordinates

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

the class LogisticsBlockGenericSubMultiBlock method collisionRayTrace.

@Override
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 origin, Vec3 direction) {
    DoubleCoordinates pos = new DoubleCoordinates(x, y, z);
    TileEntity tile = pos.getTileEntity(world);
    if (tile instanceof LogisticsTileGenericSubMultiBlock) {
        List<LogisticsTileGenericPipe> mainPipeList = ((LogisticsTileGenericSubMultiBlock) tile).getMainPipe();
        for (LogisticsTileGenericPipe mainPipe : mainPipeList) {
            if (mainPipe != null && mainPipe.pipe != null && mainPipe.pipe.isMultiBlock()) {
                MovingObjectPosition result = LogisticsPipes.LogisticsPipeBlock.collisionRayTrace(world, mainPipe.xCoord, mainPipe.yCoord, mainPipe.zCoord, origin, direction);
                if (result != null) {
                    result.blockX = x;
                    result.blockY = y;
                    result.blockZ = z;
                    return result;
                }
            }
        }
    }
    return null;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) MovingObjectPosition(net.minecraft.util.MovingObjectPosition) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates)

Example 47 with DoubleCoordinates

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

the class LogisticsBlockGenericSubMultiBlock method onNeighborBlockChange.

@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
    super.onNeighborBlockChange(world, x, y, z, block);
    DoubleCoordinates pos = new DoubleCoordinates(x, y, z);
    TileEntity tile = pos.getTileEntity(world);
    if (tile instanceof LogisticsTileGenericSubMultiBlock) {
        ((LogisticsTileGenericSubMultiBlock) tile).scheduleNeighborChange();
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates)

Example 48 with DoubleCoordinates

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

the class HSTubeSCurve method getConnectedEndTile.

@Override
public TileEntity getConnectedEndTile(ForgeDirection output) {
    boolean useOwn;
    if (orientation.getOffset().getLength() != 0) {
        if (orientation.dir.getOpposite() == output) {
            useOwn = false;
        } else if (orientation.dir == output) {
            useOwn = true;
        } else {
            return null;
        }
    } else {
        if (orientation.dir.getOpposite() == output) {
            useOwn = true;
        } else if (orientation.dir == output) {
            useOwn = false;
        } else {
            return null;
        }
    }
    if (useOwn) {
        return container.getTile(output);
    } else {
        DoubleCoordinates pos = new DoubleCoordinates(1, 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);
        }
    }
    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 49 with DoubleCoordinates

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

the class HSTubeSpeedup method getItemRenderPos.

@Override
public DoubleCoordinates getItemRenderPos(float fPos, LPTravelingItem travelItem) {
    DoubleCoordinates pos = new DoubleCoordinates(0.5D, 0.5D, 0.5D);
    float pPos = fPos;
    if (travelItem.input.getOpposite() == orientation.dir1) {
        CoordinateUtils.add(pos, orientation.dir1, 3);
        pPos = this.getPipeLength() - fPos;
    }
    if (pPos < 0.5) {
        if (travelItem.input == ForgeDirection.UNKNOWN) {
            return null;
        }
        if (!container.renderState.pipeConnectionMatrix.isConnected(travelItem.input.getOpposite())) {
            return null;
        }
        CoordinateUtils.add(pos, travelItem.input.getOpposite(), 0.5 - fPos);
    } else {
        if (travelItem.output == ForgeDirection.UNKNOWN) {
            return null;
        }
        CoordinateUtils.add(pos, travelItem.output, fPos - 0.5);
    }
    return pos;
}
Also used : DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates)

Example 50 with DoubleCoordinates

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

the class HSTubeSpeedup method addCollisionBoxesToList.

@Override
public void addCollisionBoxesToList(List arraylist, AxisAlignedBB axisalignedbb) {
    DoubleCoordinates pos = getLPPosition();
    DoubleCoordinates posMin = new DoubleCoordinates(LPConstants.PIPE_MIN_POS, LPConstants.PIPE_MIN_POS, LPConstants.PIPE_MIN_POS);
    DoubleCoordinates posMax = new DoubleCoordinates(LPConstants.PIPE_MAX_POS, LPConstants.PIPE_MAX_POS, -3);
    orientation.rotatePositions(posMin);
    orientation.rotatePositions(posMax);
    if (orientation == SpeedupDirection.EAST) {
        pos.add(new DoubleCoordinates(1, 0, 0));
    } else if (orientation == SpeedupDirection.SOUTH) {
        pos.add(new DoubleCoordinates(1, 0, 1));
    } else if (orientation == SpeedupDirection.WEST) {
        pos.add(new DoubleCoordinates(0, 0, 1));
    }
    posMin.add(pos);
    posMax.add(pos);
    LPPositionSet<DoubleCoordinates> set = new LPPositionSet<>(DoubleCoordinates.class);
    set.add(posMin);
    set.add(posMax);
    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)

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