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