@Override public void actionPerformed(IGuiWidget checkBox) { if (!(checkBox instanceof GuiLabel)) { if (checkBox.getID() < 6) { ((ISidedWidget) widget).getSides()[checkBox.getID()] = ((GuiCheckBox) checkBox).checked; } else { switch (checkBox.getID()) { case 6: ((ICondition) widget).setAndFunction(false); break; case 7: ((ICondition) widget).setAndFunction(true); break; default: ((ICondition) widget).setOperator(ICondition.Operator.values()[checkBox.getID() - 8]); } } } super.actionPerformed(checkBox); }
@Override public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_) { this.func_146276_q_(); this.func_73732_a(this.field_146289_q, String.format("The world %s contains pre-update modding data", saveName), this.field_146294_l / 2, 50, 16777215); this.func_73732_a(this.field_146289_q, String.format("There may be problems updating it to this version"), this.field_146294_l / 2, 70, 16777215); this.func_73732_a(this.field_146289_q, String.format("FML will save a zip to %s", zip.getName()), this.field_146294_l / 2, 90, 16777215); this.func_73732_a(this.field_146289_q, String.format("Do you wish to continue loading?"), this.field_146294_l / 2, 110, 16777215); int k; for (k = 0; k < this.field_146292_n.size(); ++k) { ((GuiButton)this.field_146292_n.get(k)).func_146112_a(this.field_146297_k, p_73863_1_, p_73863_2_); } for (k = 0; k < this.field_146293_o.size(); ++k) { ((GuiLabel)this.field_146293_o.get(k)).func_146159_a(this.field_146297_k, p_73863_1_, p_73863_2_); } }
@SuppressWarnings("unchecked") public static void inject(GuiScreen screen) { try { Field fieldLabelList = GuiScreen.class.getDeclaredField("labelList"); fieldLabelList.setAccessible(true); List<GuiLabel> labelList = (List<GuiLabel>) fieldLabelList.get(screen); for(GuiLabel label : labelList) { if(label instanceof LabelButtonInfo) { return; } } labelList.add(new LabelButtonInfo(Minecraft.getMinecraft().fontRendererObj, -100, 2, 2, 0, 0)); } catch (Throwable t) { Throwables.propagate(t); } }
@SuppressWarnings("unchecked") public static void remove(GuiScreen screen) { try { Field fieldLabelList = GuiScreen.class.getDeclaredField("labelList"); fieldLabelList.setAccessible(true); List<GuiLabel> labelList = (List<GuiLabel>) fieldLabelList.get(screen); Iterator<GuiLabel> it = labelList.iterator(); while(it.hasNext()) { if(it.next() instanceof LabelButtonInfo) { it.remove(); } } } catch (Throwable t) { Throwables.propagate(t); } }
@Override public void initGui() { final int drawX = (this.width + 1) / 2 - SLIDER_WIDTH / 2; final int drawY = 40; addSlider(new GuiSlider(this, ID_MASTER_SOUND, drawX, drawY, "dlg.name.MasterSound", 0F, 1F, this.master, FORMAT)); addSlider(new GuiSlider(this, ID_BIOME_SOUND, drawX, drawY + 25, "dlg.name.BiomeSound", 0F, 1F, this.biome, FORMAT)); addSlider(new GuiSlider(this, ID_FOOTSTEP_SOUND, drawX, drawY + 50, "dlg.name.FootstepSound", 0F, 1F, this.footstep, FORMAT)); final GuiLabel label = new GuiLabel(mc.fontRenderer, ID_LABEL, drawX, drawY + 75, SLIDER_WIDTH, 10, Color.MC_WHITE.rgb()); label.setCentered().addLine(Localization.format("dlg.name.Close")); this.labelList.add(label); this.panel.setMinimumWidth(SLIDER_WIDTH + mc.fontRenderer.FONT_HEIGHT * 2); this.panel.setMinimumHeight(4 * 25); }
@Override @SideOnly(Side.CLIENT) public void init(Minecraft mc, int x, int y, int lastButtonID, List<GuiButton> buttonList, List<GuiLabel> labelList) { this.lastButtonID = lastButtonID; this.buttonDown = new GuiButtonSelection(lastButtonID + 1, x + 17, y + 34); this.buttonUp = new GuiButtonSelection(lastButtonID + 2, x + 17, y); this.buttonNorth = new GuiButtonSelection(lastButtonID + 3, x + 17, y + 17); this.buttonSouth = new GuiButtonSelection(lastButtonID + 4, x + 34, y + 34); this.buttonWest = new GuiButtonSelection(lastButtonID + 5, x, y + 17); this.buttonEast = new GuiButtonSelection(lastButtonID + 6, x + 34, y + 17); buttonList.add(buttonDown); buttonList.add(buttonEast); buttonList.add(buttonNorth); buttonList.add(buttonSouth); buttonList.add(buttonUp); buttonList.add(buttonWest); }
@Override @SideOnly(Side.CLIENT) public void init(Minecraft mc, int x, int y, int lastButtonID, List<GuiButton> buttonList, List<GuiLabel> labelList) { this.lastButtonID = lastButtonID; this.buttonDown = new GuiButtonSelection(lastButtonID + 1, x + 17, y + 34); this.buttonUp = new GuiButtonSelection(lastButtonID + 2, x + 17, y); this.buttonNorth = new GuiButtonSelection(lastButtonID + 3, x + 17, y + 17); this.buttonSouth = new GuiButtonSelection(lastButtonID + 4, x + 34, y + 34); this.buttonWest = new GuiButtonSelection(lastButtonID + 5, x, y + 17); this.buttonEast = new GuiButtonSelection(lastButtonID + 6, x + 34, y + 17); this.rsButton = new GuiButtonRedstoneMode(lastButtonID + 7, x - 4, y - 4, controlType); this.buttonPowerSharing = new GuiButtonPowerSharing(lastButtonID + 8, x + 34, y - 4, powersharing); buttonList.add(buttonDown); buttonList.add(buttonEast); buttonList.add(buttonNorth); buttonList.add(buttonSouth); buttonList.add(buttonUp); buttonList.add(buttonWest); buttonList.add(rsButton); buttonList.add(buttonPowerSharing); }
public void drawScreen(int mouseX, int mouseY, float partalTicks) { super.drawScreen(mouseX, mouseY, partalTicks); List buttonList = ObfuscationReflectionHelper.getPrivateValue(GuiScreen.class, overriddenScreen, "buttonList", "field_146292_n"); List labelList = ObfuscationReflectionHelper.getPrivateValue(GuiScreen.class, overriddenScreen, "labelList", "field_146293_o"); int k1; for (k1 = 0; k1 < buttonList.size(); ++k1) { ((GuiButton)buttonList.get(k1)).drawButton(mc, mouseX, mouseY); } for (k1 = 0; k1 < labelList.size(); ++k1) { ((GuiLabel)labelList.get(k1)).func_146159_a(mc, mouseX, mouseY); } }
@Override public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_) { this.drawDefaultBackground(); this.drawCenteredString(this.fontRendererObj, String.format("The world %s contains pre-update modding data", saveName), this.width / 2, 50, 16777215); this.drawCenteredString(this.fontRendererObj, String.format("There may be problems updating it to this version"), this.width / 2, 70, 16777215); this.drawCenteredString(this.fontRendererObj, String.format("FML will save a zip to %s", zip.getName()), this.width / 2, 90, 16777215); this.drawCenteredString(this.fontRendererObj, String.format("Do you wish to continue loading?"), this.width / 2, 110, 16777215); int k; for (k = 0; k < this.buttonList.size(); ++k) { ((GuiButton)this.buttonList.get(k)).drawButton(this.mc, p_73863_1_, p_73863_2_); } for (k = 0; k < this.labelList.size(); ++k) { ((GuiLabel)this.labelList.get(k)).func_146159_a(this.mc, p_73863_1_, p_73863_2_); } }
@Override public void actionPerformed(IGuiWidget checkBox){ if(!(checkBox instanceof GuiLabel)) { if(checkBox.getID() < 6) { ((ISidedWidget)widget).getSides()[checkBox.getID()] = ((GuiCheckBox)checkBox).checked; } else { switch(checkBox.getID()){ case 6: ((ICondition)widget).setAndFunction(false); break; case 7: ((ICondition)widget).setAndFunction(true); break; default: ((ICondition)widget).setOperator(ICondition.Operator.values()[checkBox.getID() - 8]); } } } super.actionPerformed(checkBox); }
@Override public void initGui(){ super.initGui(); buttonList = new ArrayList<>(); labelList = new ArrayList<>(); int centerX = width/2; int centerY = height/2; boolean profileLoaded = LAST_SCAN_RESULT != null; startProfile = new GuiButton(BUTTON_START_PROFILE_ID, centerX - 100, centerY - 25, "Profile for " + seconds + " seconds"); GuiButton showToggle = new GuiButton(BUTTON_SHOW_TOGGLE, centerX - 100, centerY + 5, lagOverlayGui.isShowing.get() ? "Hide latest scan results" : "Show latest scan results"); GuiButton analyzeResults = new GuiButton(BUTTON_ANALYZE_RESULTS, centerX - 100, centerY + 30, "Analyze results"); updateButton(); showToggle.enabled = profileLoaded; analyzeResults.enabled = profileLoaded; addButton(startProfile); addButton(showToggle); addButton(analyzeResults); addButton(new DonateButton(BUTTON_DONATE, centerX + 10, centerY + 75)); addButton(new OptionsButton(BUTTON_OPTIONS, centerX - 100, centerY + 75)); GuiLabel scrollHint = new GuiLabel(fontRenderer, LABEL_ID, centerX - 100, centerY - 55, 200, 20, 0xFFFFFF); scrollHint.addLine("Scroll while hovering over the button"); scrollHint.addLine("to change time time!"); labelList.add(scrollHint); }
@Override public void initGui() { this.labelList.clear(); super.initGui(); GuiLabel label = new GuiLabel(this.fontRendererObj, 0, 0, this.height / 2, this.width, this.fontRendererObj.FONT_HEIGHT, Color.WHITE.getRGB()); label.setCentered(); label.addLine(I18n.format("gui.controller.pressAnyKey")); this.labelList.add(label); useMouse = new GuiButton(0, this.width / 2 - 100, this.height - 30, I18n.format("gui.controller.useMouse")); this.buttonList.add(useMouse); }
@Override public void initGui() { super.initGui(); this.buttonList.add(mButtonClose = new GuiButton(0, this.width / 2 - 100, this.height - (this.height / 4) + 10, "Close")); this.labelList.add(mLabelIpAddress = new GuiLabel(fontRendererObj, 1, this.width / 2 - 20, this.height / 2 + 40, 300, 20, 0xFFFFFF)); mIpAddressManager = new IpAddressManager(); mIpAddress = mIpAddressManager.getIpAddress(); mQrCodeManager = new QrCodeManager(mIpAddress); mLabelIpAddress.addLine(mIpAddress); }
protected void drawControlBackgroundAndButtonsAndLabels(int grayBoxX, int grayBoxY, int mouseX, int mouseY) { this.mc.getTextureManager().bindTexture(this.backgroundTextures); this.drawTexturedModalRect(grayBoxX, grayBoxY, 0, 0, 256, 256); for (int i = 0; i < this.buttonList.size(); ++i) { ((GuiButton)this.buttonList.get(i)).drawButton(this.mc, mouseX, mouseY, 0); } for (int j = 0; j < this.labelList.size(); ++j) { ((GuiLabel)this.labelList.get(j)).drawLabel(this.mc, mouseX, mouseY); } }
@Override @SideOnly(Side.CLIENT) public void init(Minecraft mc, int x, int y, int lastButtonID, List<GuiButton> buttonList, List<GuiLabel> labelList) { this.lastButtonID = lastButtonID; rsButton = new GuiButtonRedstoneMode(lastButtonID + 1, x + 40, y + 20, controlType); power = new GuiButtonForcePowerSharing(lastButtonID + 2, x + 18, y - 1, sharing); buttonList.add(rsButton); buttonList.add(power); }
@Override @SideOnly(Side.CLIENT) public void init(Minecraft mc, int x, int y, int lastButtonID, List<GuiButton> buttonList, List<GuiLabel> labelList) { this.lastButtonID = lastButtonID; rsButton = new GuiButtonRedstoneMode(lastButtonID + 1, x + 40, y, controlType); buttonList.add(rsButton); }
@Override @SideOnly(Side.CLIENT) public void init(Minecraft mc, int x, int y, int lastButtonID, List<GuiButton> buttonList, List<GuiLabel> labelList) { this.lastButtonID = lastButtonID; rsButton = new GuiButtonRedstoneMode(lastButtonID + 1, x + 20, y, controlType); buttonList.add(rsButton); }
/** * Draws the screen and all the components in it. */ public void drawScreenSuper(int mouseX, int mouseY, float partialTicks) { for (int i = 0; i < this.buttonList.size(); ++i) { ((GuiButton)this.buttonList.get(i)).drawButton(this.mc, mouseX, mouseY); } for (int j = 0; j < this.labelList.size(); ++j) { ((GuiLabel)this.labelList.get(j)).drawLabel(this.mc, mouseX, mouseY); } }
@Override public void drawScreen(int par1, int par2, float par3) { boolean inMoreOptions = ReflectionHelper.getPrivateValue(GuiCreateWorld.class, this, "field_146344_y"); if (!inMoreOptions) { GuiTextField textField = ReflectionHelper.getPrivateValue(GuiCreateWorld.class, this, "field_146333_g"); String resultFolder = ReflectionHelper.getPrivateValue(GuiCreateWorld.class, this, "field_146336_i"); String gameModeLine1 = ReflectionHelper.getPrivateValue(GuiCreateWorld.class, this, "field_146323_G"); String gameModeLine2 = ReflectionHelper.getPrivateValue(GuiCreateWorld.class, this, "field_146328_H"); drawDefaultBackground(); drawCenteredString(fontRendererObj, LocalizationUtils.translate("selectWorld.create"), width / 2, 20, -1); drawString(fontRendererObj, LocalizationUtils.translate("selectWorld.enterName"), width / 2 - 100, 47, 0xFFA0A0A0); drawString(fontRendererObj, LocalizationUtils.translate("selectWorld.resultFolder") + " " + resultFolder, width / 2 - 100, 85, 0xFFA0A0A0); textField.drawTextBox(); drawString(fontRendererObj, gameModeLine1, width / 2 - 100, 122, 0xFFA0A0A0); drawString(fontRendererObj, gameModeLine2, width / 2 - 100, 134, 0xFFA0A0A0); String regenModeDesc = ((regenMode == EnumPreset.CUSTOM) ? AdvHealthOptions.config.<String>get(AHOGlobalConfig.generalDescription) : (AHOLocalization.REGEN_MODE + "." + regenMode.toString().toLowerCase() + ".desc")); regenModeDesc = LocalizationUtils.translate(regenModeDesc); drawString(fontRendererObj, regenModeDesc, width / 2 - 100, 172, 0xFFA0A0A0); for (int i = 0; i < buttonList.size(); ++i) ((GuiButton)buttonList.get(i)).drawButton(mc, par1, par2); for (int i = 0; i < labelList.size(); ++i) ((GuiLabel)labelList.get(i)).func_146159_a(mc, par1, par2); } else super.drawScreen(par1, par2, par3); }
@Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); this.drawCenteredString(this.fontRendererObj, this.ourReason, this.width / 2, this.height / 2 - this.textHeight / 2 - this.fontRendererObj.FONT_HEIGHT * 2, 11184810); int x = this.height / 2 - this.textHeight / 2; if (this.multilineMessage != null) { for (String s : this.multilineMessage) { this.drawCenteredString(this.fontRendererObj, s, this.width / 2, x, 16777215); x += this.fontRendererObj.FONT_HEIGHT; } } //percent = (percent + 1) % 100; int loadingBackColour = 0xFF000000; int loadingFrontColour = 0xFF00FF00; int loadingOutsideColour = 0xFF222222; int loadingHeight = 20; int loadingWidth = this.width - 60; int left = this.width / 2 - (loadingWidth / 2); int top = this.height / 2 - (loadingHeight / 2) + 45; int loadingPercentWidth = (int) (((double) loadingWidth / (double) 100) * (double) percent); drawRect(left - 1, top - 1, left + loadingWidth + 1, top + loadingHeight + 1, loadingOutsideColour); drawRect(left, top, left + loadingWidth, top + loadingHeight, loadingBackColour); drawRect(left, top, left + loadingPercentWidth, top + loadingHeight, loadingFrontColour); for (int i = 0; i < this.buttonList.size(); ++i) { ((GuiButton) this.buttonList.get(i)).drawButton(this.mc, mouseX, mouseY); } for (int j = 0; j < this.labelList.size(); ++j) { ((GuiLabel) this.labelList.get(j)).func_146159_a(this.mc, mouseX, mouseY); } if (false) { lastConnectAttempt = System.currentTimeMillis(); captiveConnecting = new GuiConnecting(this, Minecraft.getMinecraft(), new ServerData("lol", ip, false)); lastNetworkManager = EventHandler.getNetworkManager(captiveConnecting); } //drawCenteredString(fontRendererObj, I18n.format("creeperhost.pregen.refresh"), this.width / 2, Math.min(this.height / 2 + 60, this.height - 30), 0xFFFFFFFF); }
@Override public void drawScreen(int par1, int par2, float par3) { if (this.launchController.disableCooldown > 0) { this.enableControllerButton.enabled = false; this.enablePadRemovalButton.enabled = false; this.hideDestinationFrequency.enabled = false; } else { boolean isOwner = FMLClientHandler.instance().getClient().thePlayer.getGameProfile().getName().equals(this.launchController.getOwnerName()); this.enableControllerButton.enabled = isOwner; this.enablePadRemovalButton.enabled = isOwner; this.hideDestinationFrequency.enabled = isOwner; } this.enableControllerButton.displayString = this.launchController.getDisabled(0) ? GCCoreUtil.translate("gui.button.enable.name") : GCCoreUtil.translate("gui.button.disable.name"); this.hideDestinationFrequency.displayString = !this.launchController.getDisabled(2) ? GCCoreUtil.translate("gui.button.unhideDest.name") : GCCoreUtil.translate("gui.button.hideDest.name"); // Hacky way of rendering buttons properly, possibly bugs here: List buttonList = new ArrayList(this.buttonList); List labelList = new ArrayList(this.labelList); List<GuiElementInfoRegion> infoRegions = new ArrayList(this.infoRegions); this.buttonList.clear(); this.labelList.clear(); this.infoRegions.clear(); super.drawScreen(par1, par2, par3); GL11.glColor3f(1, 1, 1); GL11.glDisable(GL12.GL_RESCALE_NORMAL); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); int k; for (k = 0; k < buttonList.size(); ++k) { ((GuiButton) buttonList.get(k)).drawButton(this.mc, par1, par2); } for (k = 0; k < labelList.size(); ++k) { ((GuiLabel) labelList.get(k)).func_146159_a(this.mc, par1, par2); } for (k = 0; k < infoRegions.size(); ++k) { infoRegions.get(k).drawRegion(par1, par2); } this.buttonList = buttonList; this.labelList = labelList; this.infoRegions = infoRegions; // GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); RenderHelper.enableStandardItemLighting(); if (Math.random() < 0.025 && !destinationFrequency.isTextFocused) { if (!Minecraft.getMinecraft().thePlayer.getGameProfile().getName().equals(this.launchController.getOwnerName()) && !this.launchController.getDisabled(2)) { // in case the player is not equal to the owner of the controller, // scramble the destination number such that other players can't // fly to it directly Random r = new Random(); String fakefrequency = ""; for (int i = 0; i < this.destinationFrequency.getMaxLength(); i++) fakefrequency += (char) (r.nextInt(126 - 33) + 33); destinationFrequency.text = fakefrequency; } else { destinationFrequency.text = String.valueOf(this.launchController.destFrequency); } } }
@SideOnly(Side.CLIENT) default void init(Minecraft mc, int x, int y, int lastButtonID, List<GuiButton> buttonList, List<GuiLabel> labelList) { }
@SideOnly(Side.CLIENT) public static List<GuiLabel> addTextFieldToLabelList(GuiTextField field, List<GuiLabel> labelList) { if (field != null) labelList.add(new GuiTextFieldLabel(field)); return labelList; }
@SideOnly(Side.CLIENT) public static List<GuiLabel> addNumberValueBoxToLabelList(GuiNumberValueBox field, List<GuiLabel> labelList) { if (field != null) labelList.add(new GuiNumberValueBoxLabel(field)); return labelList; }
@SideOnly(Side.CLIENT) public static List<GuiLabel> addRunnableToLabelList(GuiRenderRunnable field, List<GuiLabel> labelList) { if (field != null) labelList.add(new GuiRunnableLabel(field)); return labelList; }
@Override @SideOnly(Side.CLIENT) public void init(Minecraft mc, int x, int y, int lastButtonID, List<GuiButton> buttonList, List<GuiLabel> labelList) { this.lastButtonID = lastButtonID; this.buttonDown = new GuiButtonSelection(lastButtonID + 1, x + 17, y + 34); this.buttonUp = new GuiButtonSelection(lastButtonID + 2, x + 17, y); this.buttonNorth = new GuiButtonSelection(lastButtonID + 3, x + 17, y + 17); this.buttonSouth = new GuiButtonSelection(lastButtonID + 4, x + 34, y + 34); this.buttonWest = new GuiButtonSelection(lastButtonID + 5, x, y + 17); this.buttonEast = new GuiButtonSelection(lastButtonID + 6, x + 34, y + 17); buttonList.add(buttonDown); buttonList.add(buttonEast); buttonList.add(buttonNorth); buttonList.add(buttonSouth); buttonList.add(buttonUp); buttonList.add(buttonWest); int numId = lastButtonID + 7; int guiLeft = x + 65, guiTop = y - 20; up1 = new GuiButtonNum(numId, guiLeft + 20, guiTop + 26, 1, 1, 20); up10 = new GuiButtonNum(numId, guiLeft + 45, guiTop + 26, 10, 16, 25); up100 = new GuiButtonNum(numId, guiLeft + 75, guiTop + 26, 100, 32, 30); up1000 = new GuiButtonNum(numId, guiLeft + 110, guiTop + 26, 1000, 64, 35); down1 = new GuiButtonNum(numId, guiLeft + 20, guiTop + 76, -1, -1, 20); down10 = new GuiButtonNum(numId, guiLeft + 45, guiTop + 76, -10, -16, 25); down100 = new GuiButtonNum(numId, guiLeft + 75, guiTop + 76, -100, -32, 30); down1000 = new GuiButtonNum(numId, guiLeft + 110, guiTop + 76, -1000, -64, 35); buttonList.add(down1); buttonList.add(down10); buttonList.add(down100); buttonList.add(down1000); buttonList.add(up1); buttonList.add(up10); buttonList.add(up100); buttonList.add(up1000); numberField = new GuiTextField(1, mc.fontRenderer, guiLeft + 61, guiTop + 57, 59, 10); numberField.setTextColor(0xFFFFFF); numberField.setEnableBackgroundDrawing(true); numberField.setText("1"); numberField.setCanLoseFocus(false); numberField.setFocused(true); numberField.setMaxStringLength(6); TomsModUtils.addTextFieldToLabelList(numberField, labelList); }
public void addLabel(GuiLabel label) { labelList.add(label); }