Search in sources :

Example 11 with TubeModule

use of me.desht.pneumaticcraft.common.block.tubes.TubeModule in project pnc-repressurized by TeamPneumatic.

the class TileEntityPressureTube method onNeighborTileUpdate.

@Override
public void onNeighborTileUpdate() {
    super.onNeighborTileUpdate();
    updateConnections();
    for (TubeModule module : modules) {
        if (module != null)
            module.onNeighborTileUpdate();
    }
}
Also used : TubeModule(me.desht.pneumaticcraft.common.block.tubes.TubeModule)

Example 12 with TubeModule

use of me.desht.pneumaticcraft.common.block.tubes.TubeModule in project pnc-repressurized by TeamPneumatic.

the class TileEntityPressureTube method update.

@Override
public void update() {
    super.update();
    for (TubeModule module : modules) {
        if (module != null) {
            module.shouldDrop = true;
            module.update();
        }
    }
    List<Pair<EnumFacing, IAirHandler>> teList = getAirHandler(null).getConnectedPneumatics();
    boolean hasModules = false;
    for (TubeModule module : modules) {
        if (module != null) {
            hasModules = true;
            break;
        }
    }
    if (!hasModules && teList.size() == 1 && !getWorld().isRemote) {
        for (Pair<EnumFacing, IAirHandler> entry : teList) {
            if (entry.getKey() != null && modules[entry.getKey().getOpposite().ordinal()] == null && isConnectedTo(entry.getKey().getOpposite()))
                getAirHandler(null).airLeak(entry.getKey().getOpposite());
        }
    }
}
Also used : IAirHandler(me.desht.pneumaticcraft.api.tileentity.IAirHandler) EnumFacing(net.minecraft.util.EnumFacing) TubeModule(me.desht.pneumaticcraft.common.block.tubes.TubeModule) Pair(org.apache.commons.lang3.tuple.Pair)

Aggregations

TubeModule (me.desht.pneumaticcraft.common.block.tubes.TubeModule)12 ItemTubeModule (me.desht.pneumaticcraft.common.item.ItemTubeModule)5 TileEntityPressureTube (me.desht.pneumaticcraft.common.tileentity.TileEntityPressureTube)4 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 NBTTagList (net.minecraft.nbt.NBTTagList)2 TileEntity (net.minecraft.tileentity.TileEntity)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 ArrayList (java.util.ArrayList)1 LayoutStyle (mcjty.theoneprobe.apiimpl.styles.LayoutStyle)1 IAirHandler (me.desht.pneumaticcraft.api.tileentity.IAirHandler)1 PacketPlaySound (me.desht.pneumaticcraft.common.network.PacketPlaySound)1 EntityItem (net.minecraft.entity.item.EntityItem)1 ItemStack (net.minecraft.item.ItemStack)1 EnumFacing (net.minecraft.util.EnumFacing)1 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)1 RayTraceResult (net.minecraft.util.math.RayTraceResult)1 Pair (org.apache.commons.lang3.tuple.Pair)1