Search in sources :

Example 11 with IPneumaticMachine

use of pneumaticCraft.api.tileentity.IPneumaticMachine in project PneumaticCraft by MineMaarten.

the class TileEntityVacuumPump method getConnectedPneumatics.

@Override
public List<Pair<ForgeDirection, IAirHandler>> getConnectedPneumatics() {
    List<Pair<ForgeDirection, IAirHandler>> teList = new ArrayList<Pair<ForgeDirection, IAirHandler>>();
    ForgeDirection direction = getInputSide();
    TileEntity te = getTileCache()[direction.ordinal()].getTileEntity();
    IPneumaticMachine machine = ModInteractionUtils.getInstance().getMachine(te);
    if (machine != null && isConnectedTo(direction) && machine.isConnectedTo(direction.getOpposite())) {
        teList.add(new ImmutablePair(direction, machine.getAirHandler()));
    } else if (te instanceof ISidedPneumaticMachine) {
        IAirHandler handler = ((ISidedPneumaticMachine) te).getAirHandler(direction);
        if (handler != null) {
            teList.add(new ImmutablePair(direction, handler));
        }
    }
    return teList;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IAirHandler(pneumaticCraft.api.tileentity.IAirHandler) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) IPneumaticMachine(pneumaticCraft.api.tileentity.IPneumaticMachine) ArrayList(java.util.ArrayList) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) ISidedPneumaticMachine(pneumaticCraft.api.tileentity.ISidedPneumaticMachine) Pair(org.apache.commons.lang3.tuple.Pair) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair)

Aggregations

IPneumaticMachine (pneumaticCraft.api.tileentity.IPneumaticMachine)11 TileEntity (net.minecraft.tileentity.TileEntity)9 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)8 IAirHandler (pneumaticCraft.api.tileentity.IAirHandler)4 ArrayList (java.util.ArrayList)3 ISidedPneumaticMachine (pneumaticCraft.api.tileentity.ISidedPneumaticMachine)3 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)2 Pair (org.apache.commons.lang3.tuple.Pair)2 IPressurizable (pneumaticCraft.api.item.IPressurizable)2 IInventory (net.minecraft.inventory.IInventory)1 ItemStack (net.minecraft.item.ItemStack)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 ChatComponentTranslation (net.minecraft.util.ChatComponentTranslation)1 IChatComponent (net.minecraft.util.IChatComponent)1 ChunkPosition (net.minecraft.world.ChunkPosition)1 MutablePair (org.apache.commons.lang3.tuple.MutablePair)1 IHeatExchangerLogic (pneumaticCraft.api.IHeatExchangerLogic)1 IHeatExchanger (pneumaticCraft.api.tileentity.IHeatExchanger)1 IManoMeasurable (pneumaticCraft.api.tileentity.IManoMeasurable)1 DroneAIBlockCondition (pneumaticCraft.common.ai.DroneAIBlockCondition)1