Search in sources :

Example 1 with TileEntityPneumaticBase

use of pneumaticCraft.common.tileentity.TileEntityPneumaticBase in project PneumaticCraft by MineMaarten.

the class GuiPneumaticContainerBase method addPressureStatInfo.

protected void addPressureStatInfo(List<String> pressureStatText) {
    TileEntityPneumaticBase pneumaticTile = (TileEntityPneumaticBase) te;
    pressureStatText.add("§7Current Pressure:");
    pressureStatText.add("§0" + PneumaticCraftUtils.roundNumberTo(pneumaticTile.getPressure(ForgeDirection.UNKNOWN), 1) + " bar.");
    pressureStatText.add("§7Current Air:");
    pressureStatText.add("§0" + (double) Math.round(pneumaticTile.currentAir + pneumaticTile.volume) + " mL.");
    pressureStatText.add("§7Volume:");
    pressureStatText.add("§0" + (double) Math.round(pneumaticTile.DEFAULT_VOLUME) + " mL.");
    float volumeLeft = pneumaticTile.volume - pneumaticTile.DEFAULT_VOLUME;
    if (volumeLeft > 0) {
        pressureStatText.add("§0" + (double) Math.round(volumeLeft) + " mL. (Volume Upgrades)");
        pressureStatText.add("§0--------+");
        pressureStatText.add("§0" + (double) Math.round(pneumaticTile.volume) + " mL.");
    }
}
Also used : TileEntityPneumaticBase(pneumaticCraft.common.tileentity.TileEntityPneumaticBase)

Example 2 with TileEntityPneumaticBase

use of pneumaticCraft.common.tileentity.TileEntityPneumaticBase in project PneumaticCraft by MineMaarten.

the class ModelGauge method renderDynamic.

@Override
public void renderDynamic(float size, TileEntity te, float partialTicks) {
    Shape1.render(size);
    Shape2.render(size);
    float pressure = 0;
    float dangerPressure = 5;
    float critPressure = 7;
    if (gaugeModule != null && gaugeModule.getTube() != null) {
        TileEntityPneumaticBase base = (TileEntityPneumaticBase) ((IPneumaticMachine) gaugeModule.getTube()).getAirHandler();
        pressure = base.getPressure(ForgeDirection.UNKNOWN);
        dangerPressure = base.DANGER_PRESSURE;
        critPressure = base.CRITICAL_PRESSURE;
    }
    GL11.glTranslated(0, 1, 0.378);
    double scale = 0.008D;
    GL11.glScaled(scale, scale, scale);
    GL11.glRotated(180, 0, 1, 0);
    GL11.glDisable(GL11.GL_LIGHTING);
    GuiUtils.drawPressureGauge(FMLClientHandler.instance().getClient().fontRenderer, -1, critPressure, dangerPressure, -1, pressure, 0, 0, 0);
    GL11.glEnable(GL11.GL_LIGHTING);
}
Also used : TileEntityPneumaticBase(pneumaticCraft.common.tileentity.TileEntityPneumaticBase)

Example 3 with TileEntityPneumaticBase

use of pneumaticCraft.common.tileentity.TileEntityPneumaticBase in project PneumaticCraft by MineMaarten.

the class BlockPneumaticCraft method addInformation.

@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List curInfo, boolean extraInfo) {
    if (PneumaticCraft.proxy.isSneakingInGui()) {
        TileEntity te = createNewTileEntity(player.worldObj, 0);
        if (te instanceof TileEntityPneumaticBase) {
            float pressure = ((TileEntityPneumaticBase) te).DANGER_PRESSURE;
            curInfo.add(EnumChatFormatting.YELLOW + I18n.format("gui.tooltip.maxPressure", pressure));
        }
    }
    String info = "gui.tab.info." + stack.getUnlocalizedName();
    String translatedInfo = I18n.format(info);
    if (!translatedInfo.equals(info)) {
        if (PneumaticCraft.proxy.isSneakingInGui()) {
            translatedInfo = EnumChatFormatting.AQUA + translatedInfo.substring(2);
            if (!Loader.isModLoaded(ModIds.IGWMOD))
                translatedInfo += " \\n \\n" + I18n.format("gui.tab.info.assistIGW");
            curInfo.addAll(PneumaticCraftUtils.convertStringIntoList(translatedInfo, 60));
        } else {
            curInfo.add(EnumChatFormatting.AQUA + I18n.format("gui.tooltip.sneakForInfo"));
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityPneumaticBase(pneumaticCraft.common.tileentity.TileEntityPneumaticBase) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 4 with TileEntityPneumaticBase

use of pneumaticCraft.common.tileentity.TileEntityPneumaticBase in project PneumaticCraft by MineMaarten.

the class ModuleRegulatorTube method renderModule.

@Override
protected void renderModule() {
    super.renderModule();
    if (isFake()) {
        if (!hasTicked) {
            TileEntityPneumaticBase tile = (TileEntityPneumaticBase) getTube();
            NetworkHandler.sendToServer(new PacketDescriptionPacketRequest(tile.xCoord, tile.yCoord, tile.zCoord));
            TileEntity neighbor = tile.getWorldObj().getTileEntity(tile.xCoord + dir.offsetX, tile.yCoord + dir.offsetY, tile.zCoord + dir.offsetZ);
            inLine = neighbor instanceof IPneumaticMachine;
            if (inLine) {
                inverted = ((IPneumaticMachine) neighbor).getAirHandler().getPressure(dir) > tile.getPressure(ForgeDirection.UNKNOWN);
                NetworkHandler.sendToServer(new PacketDescriptionPacketRequest(neighbor.xCoord, neighbor.yCoord, neighbor.zCoord));
            }
            hasTicked = true;
        }
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        if (inLine && !inverted) {
            GL11.glColor4d(0, 1, 0, 0.3);
        } else {
            GL11.glColor4d(1, 0, 0, 0.3);
        }
        GL11.glPushMatrix();
        GL11.glTranslated(0, 1, 0.2 + ClientTickHandler.TICKS % 20 * 0.015);
        GL11.glRotated(90, 1, 0, 0);
        RenderUtils.render3DArrow();
        GL11.glColor4d(1, 1, 1, 1);
        GL11.glPopMatrix();
        GL11.glDisable(GL11.GL_BLEND);
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) PacketDescriptionPacketRequest(pneumaticCraft.common.network.PacketDescriptionPacketRequest) IPneumaticMachine(pneumaticCraft.api.tileentity.IPneumaticMachine) TileEntityPneumaticBase(pneumaticCraft.common.tileentity.TileEntityPneumaticBase)

Example 5 with TileEntityPneumaticBase

use of pneumaticCraft.common.tileentity.TileEntityPneumaticBase in project PneumaticCraft by MineMaarten.

the class GuiPneumaticContainerBase method drawGuiContainerBackgroundLayer.

@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int i, int j) {
    if (shouldDrawBackground()) {
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        bindGuiTexture();
        int xStart = (width - xSize) / 2;
        int yStart = (height - ySize) / 2;
        drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
    }
    GL11.glColor4d(1, 1, 1, 1);
    GL11.glDisable(GL11.GL_LIGHTING);
    for (IGuiWidget widget : widgets) {
        widget.render(i, j, partialTicks);
    }
    for (IGuiWidget widget : widgets) {
        widget.postRender(i, j, partialTicks);
    }
    if (pressureStat != null) {
        TileEntityPneumaticBase pneu = (TileEntityPneumaticBase) te;
        Point gaugeLocation = getGaugeLocation();
        if (gaugeLocation != null)
            GuiUtils.drawPressureGauge(fontRendererObj, -1, pneu.CRITICAL_PRESSURE, pneu.DANGER_PRESSURE, te instanceof IMinWorkingPressure ? ((IMinWorkingPressure) te).getMinWorkingPressure() : -1, pneu.getPressure(ForgeDirection.UNKNOWN), gaugeLocation.x, gaugeLocation.y, zLevel);
    }
}
Also used : IGuiWidget(pneumaticCraft.client.gui.widget.IGuiWidget) Point(java.awt.Point) IMinWorkingPressure(pneumaticCraft.common.tileentity.IMinWorkingPressure) Point(java.awt.Point) TileEntityPneumaticBase(pneumaticCraft.common.tileentity.TileEntityPneumaticBase)

Aggregations

TileEntityPneumaticBase (pneumaticCraft.common.tileentity.TileEntityPneumaticBase)8 Point (java.awt.Point)2 TileEntity (net.minecraft.tileentity.TileEntity)2 SideOnly (cpw.mods.fml.relauncher.SideOnly)1 Rectangle (java.awt.Rectangle)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Stack (java.util.Stack)1 IInventory (net.minecraft.inventory.IInventory)1 ItemStack (net.minecraft.item.ItemStack)1 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)1 IHeatExchanger (pneumaticCraft.api.tileentity.IHeatExchanger)1 IPneumaticMachine (pneumaticCraft.api.tileentity.IPneumaticMachine)1 IGuiWidget (pneumaticCraft.client.gui.widget.IGuiWidget)1 PacketDescriptionPacketRequest (pneumaticCraft.common.network.PacketDescriptionPacketRequest)1 IMinWorkingPressure (pneumaticCraft.common.tileentity.IMinWorkingPressure)1 IRedstoneControl (pneumaticCraft.common.tileentity.IRedstoneControl)1 TileEntityPressureTube (pneumaticCraft.common.tileentity.TileEntityPressureTube)1