Search in sources :

Example 1 with IHeatExchanger

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

the class TileEntityBase method updateImpl.

/*
     * Even though this class doesn't implement ITickable, we'll keep the base update() logic here; classes
     * which extend non-tickable subclasses might need it (e.g. TileEntityPressureChamberInterface)
     */
public void updateImpl() {
    if (firstRun && !world.isRemote) {
        // firstRun = false;
        onFirstServerUpdate();
        onNeighborTileUpdate();
        onNeighborBlockUpdate();
    }
    firstRun = false;
    upgradeCache.validate();
    if (!world.isRemote) {
        if (this instanceof IHeatExchanger) {
            ((IHeatExchanger) this).getHeatExchangerLogic(null).update();
        }
        if (descriptionFields == null)
            descriptionPacketScheduled = true;
        for (SyncedField field : getDescriptionFields()) {
            if (field.update()) {
                descriptionPacketScheduled = true;
            }
        }
        if (descriptionPacketScheduled) {
            descriptionPacketScheduled = false;
            sendDescriptionPacket();
        }
    }
}
Also used : IHeatExchanger(me.desht.pneumaticcraft.api.tileentity.IHeatExchanger) SyncedField(me.desht.pneumaticcraft.common.inventory.SyncedField)

Example 2 with IHeatExchanger

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

the class GuiAdvancedLiquidCompressor method initGui.

@Override
public void initGui() {
    super.initGui();
    addWidget(new WidgetTemperature(0, guiLeft + 92, 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 3 with IHeatExchanger

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

the class WailaHeatHandler method getNBTData.

@Nonnull
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
    if (te instanceof IHeatExchanger) {
        Set<IHeatExchangerLogic> heatExchangers = new HashSet<>();
        IHeatExchangerLogic logic = null;
        boolean isMultisided = true;
        for (EnumFacing face : EnumFacing.values()) {
            logic = ((IHeatExchanger) te).getHeatExchangerLogic(face);
            if (logic != null) {
                if (heatExchangers.contains(logic)) {
                    isMultisided = false;
                    break;
                } else {
                    heatExchangers.add(logic);
                }
            }
        }
        if (isMultisided) {
            NBTTagList tagList = new NBTTagList();
            for (EnumFacing face : EnumFacing.values()) {
                logic = ((IHeatExchanger) te).getHeatExchangerLogic(face);
                if (logic != null) {
                    NBTTagCompound heatTag = new NBTTagCompound();
                    heatTag.setByte("side", (byte) face.ordinal());
                    heatTag.setInteger("temp", (int) logic.getTemperature());
                    tagList.appendTag(heatTag);
                }
            }
            tag.setTag("heat", tagList);
        } else if (logic != null) {
            tag.setInteger("temp", (int) logic.getTemperature());
        }
    }
    return tag;
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) IHeatExchanger(me.desht.pneumaticcraft.api.tileentity.IHeatExchanger) EnumFacing(net.minecraft.util.EnumFacing) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) IHeatExchangerLogic(me.desht.pneumaticcraft.api.heat.IHeatExchangerLogic) HashSet(java.util.HashSet) Nonnull(javax.annotation.Nonnull)

Example 4 with IHeatExchanger

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

the class GuiPneumaticGenerator method initGui.

@Override
public void initGui() {
    super.initGui();
    outputStat = addAnimatedStat("Output", IC2.glassFibreCable, 0xFF555555, false);
    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 5 with IHeatExchanger

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

the class ItemManometer method onItemUseFirst.

@Override
public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
    if (world.isRemote)
        return EnumActionResult.PASS;
    ItemStack iStack = player.getHeldItem(hand);
    if (((IPressurizable) iStack.getItem()).getPressure(iStack) > 0F) {
        TileEntity te = world.getTileEntity(pos);
        IPneumaticMachine machine = ModInteractionUtils.getInstance().getMachine(te);
        List<ITextComponent> curInfo = new ArrayList<>();
        List<String> info = new ArrayList<>();
        if (machine != null && machine.getAirHandler(side) != null) {
            machine.getAirHandler(side).printManometerMessage(player, info);
        }
        if (te instanceof IManoMeasurable) {
            ((IManoMeasurable) te).printManometerMessage(player, info);
        }
        for (String s : info) curInfo.add(new TextComponentTranslation(s));
        if (te instanceof IHeatExchanger) {
            IHeatExchangerLogic exchanger = ((IHeatExchanger) te).getHeatExchangerLogic(side);
            if (exchanger != null) {
                curInfo.add(new TextComponentTranslation("waila.temperature", (int) exchanger.getTemperature() - 273));
            } else {
                for (EnumFacing d : EnumFacing.VALUES) {
                    exchanger = ((IHeatExchanger) te).getHeatExchangerLogic(d);
                    if (exchanger != null) {
                        curInfo.add(new TextComponentTranslation("waila.temperature." + d.toString().toLowerCase(), (int) exchanger.getTemperature() - 273));
                    }
                }
            }
        }
        if (curInfo.size() > 0) {
            ((IPressurizable) iStack.getItem()).addAir(iStack, -30);
            for (ITextComponent s : curInfo) {
                player.sendStatusMessage(s, false);
            }
            return EnumActionResult.SUCCESS;
        }
    } else {
        player.sendStatusMessage(new TextComponentString(TextFormatting.RED + "The Manometer doesn't have any charge!"), false);
        return EnumActionResult.FAIL;
    }
    return EnumActionResult.PASS;
}
Also used : IPressurizable(me.desht.pneumaticcraft.api.item.IPressurizable) TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) IManoMeasurable(me.desht.pneumaticcraft.api.tileentity.IManoMeasurable) EnumFacing(net.minecraft.util.EnumFacing) ITextComponent(net.minecraft.util.text.ITextComponent) ArrayList(java.util.ArrayList) TextComponentString(net.minecraft.util.text.TextComponentString) TextComponentString(net.minecraft.util.text.TextComponentString) TileEntity(net.minecraft.tileentity.TileEntity) IHeatExchanger(me.desht.pneumaticcraft.api.tileentity.IHeatExchanger) IPneumaticMachine(me.desht.pneumaticcraft.api.tileentity.IPneumaticMachine) ItemStack(net.minecraft.item.ItemStack) 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