Search in sources :

Example 1 with AdvancedAABB

use of blusunrize.immersiveengineering.api.AdvancedAABB in project ImmersiveEngineering by BluSunrize.

the class TileEntityFluidPipe method hammerUseSide.

@Override
public boolean hammerUseSide(EnumFacing side, EntityPlayer player, float hitX, float hitY, float hitZ) {
    if (worldObj.isRemote)
        return true;
    EnumFacing fd = side;
    List<AxisAlignedBB> boxes = this.getAdvancedSelectionBounds();
    for (AxisAlignedBB box : boxes) if (box instanceof AdvancedAABB) {
        if (box.expand(.002, .002, .002).isVecInside(new Vec3d(getPos().getX() + hitX, getPos().getY() + hitY, getPos().getZ() + hitZ)))
            if (box instanceof AdvancedAABB && ((AdvancedAABB) box).fd != null)
                fd = ((AdvancedAABB) box).fd;
    }
    if (fd != null) {
        toggleSide(fd.ordinal());
        this.markContainingBlockForUpdate(null);
        TileEntityFluidPipe.indirectConnections.clear();
        return true;
    }
    return false;
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) EnumFacing(net.minecraft.util.EnumFacing) AdvancedAABB(blusunrize.immersiveengineering.api.AdvancedAABB) Vec3d(net.minecraft.util.math.Vec3d)

Example 2 with AdvancedAABB

use of blusunrize.immersiveengineering.api.AdvancedAABB in project ImmersiveEngineering by BluSunrize.

the class TileEntityFluidPipe method getAdvancedSelectionBounds.

@Override
public List<AxisAlignedBB> getAdvancedSelectionBounds() {
    List<AxisAlignedBB> list = Lists.newArrayList();
    byte connections = getAvailableConnectionByte();
    byte availableConnections = getConnectionByte();
    double[] baseAABB = pipeCover != null ? new double[] { .002, .998, .002, .998, .002, .998 } : new double[] { .25, .75, .25, .75, .25, .75 };
    for (int i = 0; i < 6; i++) {
        double depth = getConnectionStyle(i) == 0 ? .25 : .125;
        double size = getConnectionStyle(i) == 0 ? .25 : .125;
        //				size = 0;
        if ((connections & 0x1) == 1)
            list.add(new AdvancedAABB(new AxisAlignedBB(i == 4 ? 0 : i == 5 ? 1 - depth : size, i == 0 ? 0 : i == 1 ? 1 - depth : size, i == 2 ? 0 : i == 3 ? 1 - depth : size, i == 4 ? depth : i == 5 ? 1 : 1 - size, i == 0 ? depth : i == 1 ? 1 : 1 - size, i == 2 ? depth : i == 3 ? 1 : 1 - size).offset(getPos()), EnumFacing.getFront(i)));
        if ((availableConnections & 0x1) == 1)
            baseAABB[i] += i % 2 == 1 ? .125 : -.125;
        baseAABB[i] = Math.min(Math.max(baseAABB[i], 0), 1);
        availableConnections = (byte) (availableConnections >> 1);
        connections = (byte) (connections >> 1);
    }
    list.add(new AdvancedAABB(new AxisAlignedBB(baseAABB[4], baseAABB[0], baseAABB[2], baseAABB[5], baseAABB[1], baseAABB[3]).offset(getPos()), null));
    return list;
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) AdvancedAABB(blusunrize.immersiveengineering.api.AdvancedAABB)

Example 3 with AdvancedAABB

use of blusunrize.immersiveengineering.api.AdvancedAABB in project ImmersiveEngineering by BluSunrize.

the class TileEntityFluidPipe method isOverrideBox.

@Override
public boolean isOverrideBox(AxisAlignedBB box, EntityPlayer player, RayTraceResult mop, ArrayList<AxisAlignedBB> list) {
    if (box instanceof AdvancedAABB) {
        if (box.expand(.002, .002, .002).isVecInside(mop.hitVec)) {
            AxisAlignedBB changedBox = ((AdvancedAABB) box).fd != null ? box.expand(((AdvancedAABB) box).fd.getFrontOffsetX() != 0 ? 0 : .03125, ((AdvancedAABB) box).fd.getFrontOffsetY() != 0 ? 0 : .03125, ((AdvancedAABB) box).fd.getFrontOffsetZ() != 0 ? 0 : .03125) : box;
            list.add(changedBox);
            return true;
        }
    }
    return false;
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) AdvancedAABB(blusunrize.immersiveengineering.api.AdvancedAABB)

Aggregations

AdvancedAABB (blusunrize.immersiveengineering.api.AdvancedAABB)3 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)3 EnumFacing (net.minecraft.util.EnumFacing)1 Vec3d (net.minecraft.util.math.Vec3d)1