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