Search in sources :

Example 6 with IPneumaticMachine

use of me.desht.pneumaticcraft.api.tileentity.IPneumaticMachine in project pnc-repressurized by TeamPneumatic.

the class AirHandler method getConnectedPneumatics.

/**
 * Retrieves a list of all the connecting pneumatics. It takes sides in account.
 *
 * @return a list of face->air-handler pairs
 */
@Override
public List<Pair<EnumFacing, IAirHandler>> getConnectedPneumatics() {
    List<Pair<EnumFacing, IAirHandler>> teList = new ArrayList<>();
    for (IAirHandler specialConnection : specialConnectedHandlers) {
        teList.add(new ImmutablePair<>(null, specialConnection));
    }
    for (EnumFacing direction : EnumFacing.VALUES) {
        TileEntity te = getTileCache()[direction.ordinal()].getTileEntity();
        IPneumaticMachine machine = ModInteractionUtils.getInstance().getMachine(te);
        if (machine != null && parentPneumatic.getAirHandler(direction) == this && machine.getAirHandler(direction.getOpposite()) != null) {
            teList.add(new ImmutablePair<>(direction, machine.getAirHandler(direction.getOpposite())));
        }
    }
    if (airListener != null)
        airListener.addConnectedPneumatics(teList);
    return teList;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IAirHandler(me.desht.pneumaticcraft.api.tileentity.IAirHandler) IPneumaticMachine(me.desht.pneumaticcraft.api.tileentity.IPneumaticMachine) EnumFacing(net.minecraft.util.EnumFacing) MutablePair(org.apache.commons.lang3.tuple.MutablePair) Pair(org.apache.commons.lang3.tuple.Pair) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair)

Aggregations

IPneumaticMachine (me.desht.pneumaticcraft.api.tileentity.IPneumaticMachine)6 TileEntity (net.minecraft.tileentity.TileEntity)6 IAirHandler (me.desht.pneumaticcraft.api.tileentity.IAirHandler)2 IHeatExchanger (me.desht.pneumaticcraft.api.tileentity.IHeatExchanger)2 EnumFacing (net.minecraft.util.EnumFacing)2 ArrayList (java.util.ArrayList)1 Nonnull (javax.annotation.Nonnull)1 IHeatExchangerLogic (me.desht.pneumaticcraft.api.heat.IHeatExchangerLogic)1 IPressurizable (me.desht.pneumaticcraft.api.item.IPressurizable)1 IManoMeasurable (me.desht.pneumaticcraft.api.tileentity.IManoMeasurable)1 PacketDescriptionPacketRequest (me.desht.pneumaticcraft.common.network.PacketDescriptionPacketRequest)1 IInfoForwarder (me.desht.pneumaticcraft.common.thirdparty.waila.IInfoForwarder)1 TileEntityPneumaticBase (me.desht.pneumaticcraft.common.tileentity.TileEntityPneumaticBase)1 ItemStack (net.minecraft.item.ItemStack)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 BlockPos (net.minecraft.util.math.BlockPos)1 ITextComponent (net.minecraft.util.text.ITextComponent)1 TextComponentString (net.minecraft.util.text.TextComponentString)1 TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)1 IFluidHandler (net.minecraftforge.fluids.capability.IFluidHandler)1