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();
}
}
}
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));
}
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;
}
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));
}
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;
}
Aggregations