Search in sources :

Example 6 with IHeatExchanger

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

the class BlockPneumaticCraft method addProbeInfo.

@Override
@Optional.Method(modid = "theoneprobe")
public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) {
    TileEntity te = world.getTileEntity(data.getPos());
    if (te instanceof IInfoForwarder) {
        te = ((IInfoForwarder) te).getInfoTileEntity();
    }
    if (te instanceof IPneumaticMachine) {
        TOPCallback.handlePneumatic(mode, probeInfo, (IPneumaticMachine) te);
    }
    if (te instanceof IHeatExchanger) {
        TOPCallback.handleHeat(mode, probeInfo, (IHeatExchanger) te);
    }
    if (ConfigHandler.client.topShowsFluids && te != null && te.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, data.getSideHit())) {
        IFluidHandler handler = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, data.getSideHit());
        TOPCallback.handleFluidTanks(mode, probeInfo, handler);
    }
    if (te instanceof TileEntityBase) {
        TOPCallback.handleRedstoneMode(mode, probeInfo, (TileEntityBase) te);
    }
    if (te instanceof TileEntityPressureTube) {
        TOPCallback.handlePressureTube(mode, probeInfo, (TileEntityPressureTube) te, data.getSideHit());
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IHeatExchanger(me.desht.pneumaticcraft.api.tileentity.IHeatExchanger) IPneumaticMachine(me.desht.pneumaticcraft.api.tileentity.IPneumaticMachine) IInfoForwarder(me.desht.pneumaticcraft.common.thirdparty.waila.IInfoForwarder) IFluidHandler(net.minecraftforge.fluids.capability.IFluidHandler)

Example 7 with IHeatExchanger

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

the class GuiAdvancedAirCompressor method initGui.

@Override
public void initGui() {
    super.initGui();
    addWidget(new WidgetTemperature(0, guiLeft + 87, guiTop + 20, 273, 675, ((IHeatExchanger) te).getHeatExchangerLogic(null), 325, 625));
}
Also used : IHeatExchanger(me.desht.pneumaticcraft.api.tileentity.IHeatExchanger) WidgetTemperature(me.desht.pneumaticcraft.client.gui.widget.WidgetTemperature)

Example 8 with IHeatExchanger

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

the class TileEntityBase method addLuaMethods.

protected void addLuaMethods() {
    if (this instanceof IHeatExchanger) {
        final IHeatExchanger exchanger = (IHeatExchanger) this;
        luaMethods.add(new LuaMethod("getTemperature") {

            @Override
            public Object[] call(Object[] args) throws Exception {
                if (args.length == 0) {
                    return new Object[] { exchanger.getHeatExchangerLogic(null).getTemperature() };
                } else if (args.length == 1) {
                    IHeatExchangerLogic logic = exchanger.getHeatExchangerLogic(getDirForString((String) args[0]));
                    return new Object[] { logic != null ? logic.getTemperature() : 0 };
                } else {
                    throw new IllegalArgumentException("getTemperature method requires 0 or 1 argument (direction: up, down, east, west, north, south!");
                }
            }
        });
    }
}
Also used : IHeatExchanger(me.desht.pneumaticcraft.api.tileentity.IHeatExchanger) LuaMethod(me.desht.pneumaticcraft.common.thirdparty.computercraft.LuaMethod) ILuaMethod(me.desht.pneumaticcraft.common.thirdparty.computercraft.ILuaMethod) TextComponentString(net.minecraft.util.text.TextComponentString) LuaException(dan200.computercraft.api.lua.LuaException) IHeatExchangerLogic(me.desht.pneumaticcraft.api.heat.IHeatExchangerLogic)

Aggregations

IHeatExchanger (me.desht.pneumaticcraft.api.tileentity.IHeatExchanger)8 IHeatExchangerLogic (me.desht.pneumaticcraft.api.heat.IHeatExchangerLogic)3 WidgetTemperature (me.desht.pneumaticcraft.client.gui.widget.WidgetTemperature)3 IPneumaticMachine (me.desht.pneumaticcraft.api.tileentity.IPneumaticMachine)2 TileEntity (net.minecraft.tileentity.TileEntity)2 EnumFacing (net.minecraft.util.EnumFacing)2 TextComponentString (net.minecraft.util.text.TextComponentString)2 LuaException (dan200.computercraft.api.lua.LuaException)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Nonnull (javax.annotation.Nonnull)1 IPressurizable (me.desht.pneumaticcraft.api.item.IPressurizable)1 IManoMeasurable (me.desht.pneumaticcraft.api.tileentity.IManoMeasurable)1 SyncedField (me.desht.pneumaticcraft.common.inventory.SyncedField)1 ILuaMethod (me.desht.pneumaticcraft.common.thirdparty.computercraft.ILuaMethod)1 LuaMethod (me.desht.pneumaticcraft.common.thirdparty.computercraft.LuaMethod)1 IInfoForwarder (me.desht.pneumaticcraft.common.thirdparty.waila.IInfoForwarder)1 ItemStack (net.minecraft.item.ItemStack)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 NBTTagList (net.minecraft.nbt.NBTTagList)1