Search in sources :

Example 1 with PrimaryBoxData

use of gregtech.api.cover.ICoverable.PrimaryBoxData in project GregTech by GregTechCE.

the class BlockPipe method getCollisionBox.

private List<IndexedCuboid6> getCollisionBox(IBlockAccess world, BlockPos pos) {
    IPipeTile<PipeType, NodeDataType> pipeTile = getPipeTileEntity(world, pos);
    if (pipeTile == null) {
        return Collections.emptyList();
    }
    PipeType pipeType = pipeTile.getPipeType();
    if (pipeType == null) {
        return Collections.emptyList();
    }
    int actualConnections = getActualConnections(pipeTile, world);
    float thickness = pipeType.getThickness();
    ArrayList<IndexedCuboid6> result = new ArrayList<>();
    result.add(new IndexedCuboid6(new PrimaryBoxData(false), getSideBox(null, thickness)));
    ICoverable coverable = pipeTile.getCoverableImplementation();
    for (EnumFacing side : EnumFacing.VALUES) {
        if ((actualConnections & 1 << side.getIndex()) > 0) {
            result.add(new IndexedCuboid6(new PipeConnectionData(side), getSideBox(side, thickness)));
        }
    }
    coverable.addCoverCollisionBoundingBox(result);
    return result;
}
Also used : ICoverable(gregtech.api.cover.ICoverable) PrimaryBoxData(gregtech.api.cover.ICoverable.PrimaryBoxData) IndexedCuboid6(codechicken.lib.raytracer.IndexedCuboid6) ArrayList(java.util.ArrayList)

Aggregations

IndexedCuboid6 (codechicken.lib.raytracer.IndexedCuboid6)1 ICoverable (gregtech.api.cover.ICoverable)1 PrimaryBoxData (gregtech.api.cover.ICoverable.PrimaryBoxData)1 ArrayList (java.util.ArrayList)1