use of pneumaticCraft.client.gui.widget.IGuiWidget in project PneumaticCraft by MineMaarten.
the class PneumaticCraftPlugins method handleTooltip.
@Override
public List<String> handleTooltip(GuiRecipe guiRecipe, List<String> currenttip, int recipe) {
// super.handleTooltip(guiRecipe, currenttip, recipe);
MultipleInputOutputRecipe r = (MultipleInputOutputRecipe) arecipes.get(recipe);
if (GuiContainerManager.shouldShowTooltip(guiRecipe)) {
Point mouse = GuiDraw.getMousePosition();
Point offset = guiRecipe.getRecipePosition(recipe);
Point relMouse = new Point(mouse.x - (guiRecipe.width - 176) / 2 - offset.x, mouse.y - (guiRecipe.height - 166) / 2 - offset.y);
for (IGuiWidget widget : r.tooltipWidgets) {
if (widget.getBounds().contains(relMouse)) {
widget.addTooltip(mouse.x, mouse.y, currenttip, false);
}
}
if (r.tempWidget != null) {
if (r.tempWidget.getBounds().contains(relMouse)) {
r.heatExchanger.setTemperature(r.tempWidget.getScales()[0]);
r.tempWidget.addTooltip(mouse.x, mouse.y, currenttip, false);
}
}
}
return currenttip;
}
use of pneumaticCraft.client.gui.widget.IGuiWidget in project PneumaticCraft by MineMaarten.
the class GuiPneumaticScreenBase method drawScreen.
@Override
public void drawScreen(int x, int y, float partialTicks) {
if (getTexture() != null) {
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(getTexture());
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
}
super.drawScreen(x, y, partialTicks);
for (IGuiWidget widget : widgets) {
widget.render(x, y, partialTicks);
}
for (IGuiWidget widget : widgets) {
widget.postRender(x, y, partialTicks);
}
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glColor4d(1, 1, 1, 1);
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);
}
}
}
boolean shift = PneumaticCraft.proxy.isSneakingInGui();
for (IGuiWidget widget : widgets) {
if (widget.getBounds().contains(x, y))
widget.addTooltip(x, y, tooltip, shift);
}
if (!tooltip.isEmpty()) {
List<String> localizedTooltip = new ArrayList<String>();
for (String line : tooltip) {
String localizedLine = I18n.format(line);
for (String wrappedLine : localizedLine.split("\\\\n")) {
String[] lines = WordUtils.wrap(wrappedLine, 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 updateScreen.
@Override
public void updateScreen() {
super.updateScreen();
for (IGuiWidget widget : widgets) widget.update();
if (pressureStat != null) {
List<String> curInfo = new ArrayList<String>();
addPressureStatInfo(curInfo);
pressureStat.setText(curInfo);
}
if (problemTab != null) {
List<String> curInfo = new ArrayList<String>();
addProblems(curInfo);
if (curInfo.size() == 0) {
curInfo.add("gui.tab.problems.noProblems");
}
problemTab.setText(curInfo);
}
if (redstoneTab != null) {
redstoneButton.displayString = I18n.format(getRedstoneButtonText(((IRedstoneControl) te).getRedstoneMode()));
}
}
use of pneumaticCraft.client.gui.widget.IGuiWidget 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);
}
}
use of pneumaticCraft.client.gui.widget.IGuiWidget in project PneumaticCraft by MineMaarten.
the class GuiProgWidgetLiquidFilter method addValidFluids.
private void addValidFluids() {
List<Fluid> fluids = new ArrayList<Fluid>();
for (Fluid fluid : FluidRegistry.getRegisteredFluids().values()) {
if (fluid.getLocalizedName(new FluidStack(fluid, 1)).toLowerCase().contains(searchField.getText())) {
fluids.add(fluid);
}
}
scrollbar.setStates(Math.max(0, (fluids.size() - GRID_WIDTH * GRID_HEIGHT + GRID_WIDTH - 1) / GRID_WIDTH));
int offset = scrollbar.getState() * GRID_WIDTH;
for (IGuiWidget widget : widgets) {
if (widget.getID() >= 0 && widget instanceof WidgetFluidFilter) {
int idWithOffset = widget.getID() + offset;
((WidgetFluidFilter) widget).setFluid(idWithOffset >= 0 && idWithOffset < fluids.size() ? fluids.get(idWithOffset) : null);
}
}
}
Aggregations