Search in sources :

Example 1 with IGuiWidget

use of pneumaticCraft.client.gui.widget.IGuiWidget in project PneumaticCraft by MineMaarten.

the class GuiPneumaticContainerBase method drawScreen.

@Override
public void drawScreen(int x, int y, float partialTick) {
    super.drawScreen(x, y, partialTick);
    List<String> tooltip = new ArrayList<String>();
    for (Object obj : buttonList) {
        if (obj instanceof GuiButtonSpecial) {
            GuiButtonSpecial button = (GuiButtonSpecial) obj;
            if (button.xPosition < x && button.xPosition + button.getWidth() > x && button.yPosition < y && button.yPosition + button.getHeight() > y) {
                button.getTooltip(tooltip);
            }
        }
    }
    GL11.glColor4d(1, 1, 1, 1);
    GL11.glDisable(GL11.GL_LIGHTING);
    for (IGuiWidget widget : widgets) {
        if (widget.getBounds().contains(x, y))
            widget.addTooltip(x, y, tooltip, PneumaticCraft.proxy.isSneakingInGui());
    }
    if (tooltip.size() > 0) {
        drawHoveringString(tooltip, x, y, fontRendererObj);
        tooltip.clear();
    }
/* TODO boolean shift = PneumaticCraft.proxy.isSneakingInGui();
         for(IGuiWidget widget : widgets) {
             if(widget.getBounds().contains(x, y)) widget.addTooltip(tooltip, shift);
         }
         if(!tooltip.isEmpty()) {
             List<String> localizedTooltip = new ArrayList<String>();
             for(String line : tooltip) {
                 String localizedLine = I18n.format(line);
                 String[] lines = WordUtils.wrap(localizedLine, 50).split(System.getProperty("line.separator"));
                 for(String locLine : lines) {
                     localizedTooltip.add(locLine);
                 }
             }
             drawHoveringText(localizedTooltip, x, y, fontRendererObj);
         }*/
}
Also used : IGuiWidget(pneumaticCraft.client.gui.widget.IGuiWidget) ArrayList(java.util.ArrayList)

Example 2 with IGuiWidget

use of pneumaticCraft.client.gui.widget.IGuiWidget in project PneumaticCraft by MineMaarten.

the class GuiPneumaticContainerBase method refreshScreen.

protected void refreshScreen() {
    ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight);
    int i = scaledresolution.getScaledWidth();
    int j = scaledresolution.getScaledHeight();
    setWorldAndResolution(Minecraft.getMinecraft(), i, j);
    for (IGuiWidget widget : widgets) {
        if (widget instanceof GuiAnimatedStat) {
            widget.update();
        }
    }
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) IGuiWidget(pneumaticCraft.client.gui.widget.IGuiWidget) GuiAnimatedStat(pneumaticCraft.client.gui.widget.GuiAnimatedStat) IGuiAnimatedStat(pneumaticCraft.api.client.IGuiAnimatedStat) Point(java.awt.Point)

Example 3 with IGuiWidget

use of pneumaticCraft.client.gui.widget.IGuiWidget in project PneumaticCraft by MineMaarten.

the class GuiPneumaticContainerBase method modifyVisiblity.

//-----------NEI support
@Override
@Optional.Method(modid = ModIds.NEI)
public VisiblityData modifyVisiblity(GuiContainer gui, VisiblityData currentVisibility) {
    for (IGuiWidget w : widgets) {
        if (w instanceof IGuiAnimatedStat) {
            IGuiAnimatedStat stat = (IGuiAnimatedStat) w;
            if (stat.isLeftSided()) {
                if (stat.getWidth() > 20) {
                    currentVisibility.showUtilityButtons = false;
                    currentVisibility.showStateButtons = false;
                }
            } else {
                if (stat.getAffectedY() < 10) {
                    currentVisibility.showWidgets = false;
                }
            }
        }
    }
    return currentVisibility;
}
Also used : IGuiWidget(pneumaticCraft.client.gui.widget.IGuiWidget) IGuiAnimatedStat(pneumaticCraft.api.client.IGuiAnimatedStat)

Example 4 with IGuiWidget

use of pneumaticCraft.client.gui.widget.IGuiWidget in project PneumaticCraft by MineMaarten.

the class ProgWidgetBlockCondition method getOptionWindow.

@Override
@SideOnly(Side.CLIENT)
public GuiScreen getOptionWindow(GuiProgrammer guiProgrammer) {
    return new GuiProgWidgetCondition(this, guiProgrammer) {

        @Override
        public void initGui() {
            super.initGui();
            addWidget(new GuiCheckBox(500, guiLeft + 5, guiTop + 60, 0xFF000000, I18n.format("gui.progWidget.conditionBlock.checkForAir")).setChecked(checkingForAir).setTooltip(I18n.format("gui.progWidget.conditionBlock.checkForAir.tooltip")));
            addWidget(new GuiCheckBox(501, guiLeft + 5, guiTop + 72, 0xFF000000, I18n.format("gui.progWidget.conditionBlock.checkForLiquids")).setChecked(checkingForLiquids).setTooltip(I18n.format("gui.progWidget.conditionBlock.checkForLiquids.tooltip")));
        }

        @Override
        protected boolean requiresNumber() {
            return false;
        }

        @Override
        protected boolean isSidedWidget() {
            return false;
        }

        @Override
        public void actionPerformed(IGuiWidget widget) {
            if (widget.getID() == 500)
                checkingForAir = !checkingForAir;
            if (widget.getID() == 501)
                checkingForLiquids = !checkingForLiquids;
            else
                super.actionPerformed(widget);
        }
    };
}
Also used : IGuiWidget(pneumaticCraft.client.gui.widget.IGuiWidget) GuiProgWidgetCondition(pneumaticCraft.client.gui.programmer.GuiProgWidgetCondition) GuiCheckBox(pneumaticCraft.client.gui.widget.GuiCheckBox) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 5 with IGuiWidget

use of pneumaticCraft.client.gui.widget.IGuiWidget in project PneumaticCraft by MineMaarten.

the class PneumaticCraftPlugins method drawExtras.

@Override
public void drawExtras(int recipe) {
    MultipleInputOutputRecipe r = (MultipleInputOutputRecipe) arecipes.get(recipe);
    // drawAnimatedPressureGauge(120, 27, -1, r.getRequiredPressure(null, null), PneumaticValues.DANGER_PRESSURE_PRESSURE_CHAMBER, PneumaticValues.MAX_PRESSURE_PRESSURE_CHAMBER, cycleticks % 48 / 48F);
    for (IGuiWidget widget : r.tooltipWidgets) {
        widget.render(0, 0, 0);
    }
    if (r.usePressure) {
        drawAnimatedPressureGauge(r.gaugeX, r.gaugeY, -1, r.pressure, 5, 7, cycleticks % 48 / 48F);
    }
    if (r.tempWidget != null) {
        r.heatExchanger.setTemperature(cycleticks % 48 / 48F * (r.tempWidget.getScales()[0] - 273) + 273);
        r.tempWidget.render(0, 0, 0);
    }
}
Also used : IGuiWidget(pneumaticCraft.client.gui.widget.IGuiWidget)

Aggregations

IGuiWidget (pneumaticCraft.client.gui.widget.IGuiWidget)10 ArrayList (java.util.ArrayList)4 Point (java.awt.Point)3 IGuiAnimatedStat (pneumaticCraft.api.client.IGuiAnimatedStat)2 SideOnly (cpw.mods.fml.relauncher.SideOnly)1 ScaledResolution (net.minecraft.client.gui.ScaledResolution)1 Fluid (net.minecraftforge.fluids.Fluid)1 FluidStack (net.minecraftforge.fluids.FluidStack)1 GuiProgWidgetCondition (pneumaticCraft.client.gui.programmer.GuiProgWidgetCondition)1 GuiAnimatedStat (pneumaticCraft.client.gui.widget.GuiAnimatedStat)1 GuiCheckBox (pneumaticCraft.client.gui.widget.GuiCheckBox)1 WidgetFluidFilter (pneumaticCraft.client.gui.widget.WidgetFluidFilter)1 IMinWorkingPressure (pneumaticCraft.common.tileentity.IMinWorkingPressure)1 TileEntityPneumaticBase (pneumaticCraft.common.tileentity.TileEntityPneumaticBase)1