public GuiCheckBox addCheckBox(int x, int y, String text, boolean checked) { GuiCheckBox checkBox = new GuiCheckBox(lastButtonId++, x, y, text, checked); buttonList.add(checkBox); return checkBox; }
public void updateOredictPattern(boolean checked) { if (oredictPattern != null) { oredictPattern.setIsChecked(checked); } }
@Override protected void actionPerformed(GuiButton button) throws IOException { super.actionPerformed(button); tabs.actionPerformed(button); if (button == oredictPattern) { TileDataManager.setParameter(TileGrid.OREDICT_PATTERN, oredictPattern.isChecked()); } else if (button == processingPattern) { // Rebuild the inventory slots before the slot change packet arrives. TileGrid.PROCESSING_PATTERN.setValue(false, processingPattern.isChecked()); ((NetworkNodeGrid) grid).clearMatrix(); // The server does this but let's do it earlier so the client doesn't notice. ((ContainerGrid) this.inventorySlots).initSlots(); TileDataManager.setParameter(TileGrid.PROCESSING_PATTERN, processingPattern.isChecked()); } }
if(this.guiMachineLockedButton.mousePressed(this.mc, mouseX, mouseY)) { this.guiMachineLockedButton.playPressSound(this.mc.getSoundHandler()); this.actionPerformed(this.guiMachineLockedButton);
protected void drawWhitelist(float partialTicks, int mouseX, int mouseY) { guiWhiteListInput.drawTextBox(); guiWhiteListAddButton.drawButton(this.mc, mouseX, mouseY, partialTicks); guiMachineLockedButton.drawButton(this.mc, mouseX, mouseY, partialTicks); guiWhiteList.drawScreen(mouseX, mouseY, partialTicks); int offsetX = (int)((this.width - this.windowWidth) / 2.0f); int offsetY = (int)((this.height - this.windowHeight) / 2.0f); fontRenderer.drawString("Lock for other players", offsetX+20, offsetY+9, 0x1f2429); fontRenderer.drawString("Whitelist:", offsetX+6, offsetY+34, 0x1f2429); }
@Override public void init(int x, int y) { compareNbt = addCheckBox(x + 7, y + 77, t("gui.refinedstorage:filter.compare_nbt"), (compare & IComparer.COMPARE_NBT) == IComparer.COMPARE_NBT); compareDamage = addCheckBox(x + 7 + compareNbt.getButtonWidth() + 4, y + 77, t("gui.refinedstorage:filter.compare_damage"), (compare & IComparer.COMPARE_DAMAGE) == IComparer.COMPARE_DAMAGE); compareDamage.visible = type == IType.ITEMS; toggleModFilter = addCheckBox(0, y + 71 + 25, t("gui.refinedstorage:filter.mod_filter"), modFilter); toggleMode = addButton(x + 7, y + 71 + 21, 0, 20, ""); updateModeButton(mode); nameField = new GuiTextField(0, fontRenderer, x + 34, y + 121, 137 - 6, fontRenderer.FONT_HEIGHT); nameField.setText(name); nameField.setEnableBackgroundDrawing(false); nameField.setVisible(true); nameField.setCanLoseFocus(true); nameField.setFocused(false); nameField.setTextColor(16777215); addSideButton(new SideButtonFilterType(this)); }
@Override protected void actionPerformed(GuiButton button) throws IOException { super.actionPerformed(button); for (int i = 0; i < permissions.length; ++i) { if (button == permissions[i]) { RS.INSTANCE.network.sendToServer(new MessageSecurityManagerUpdate(securityManager, Permission.values()[i], permissions[i].isChecked())); } } }
@Override public void initGui() { super.initGui(); // Restore previously selected values when reopening this gui if(parent.chunkProviderSettingsJson != null && !parent.chunkProviderSettingsJson.trim().isEmpty()) { config = new SkyWorldConfiguration(parent.chunkProviderSettingsJson); } else { config = new SkyWorldConfiguration(); } int yOffset = 8; lockedButton = new GuiCheckBox(0, 8, yOffset, I18n.format("gui.compactmachines3.compactsky.configuration.startLocked"), config.startLocked); this.buttonList.add(lockedButton); yOffset += 14; int listHeight = this.height - 52 - yOffset; guiSchemaList = new SchemaScrollingList(this, 8, yOffset, 200, listHeight, 20); closeButton = new GuiButton(100, this.width / 2 - 75, this.height-28, 150, 20, I18n.format("gui.done")); this.buttonList.add(closeButton); }
@Override public void update(int x, int y) { ItemStack card = securityManager.getNode().getEditCard().getStackInSlot(0); for (Permission permission : Permission.values()) { permissions[permission.getId()].setIsChecked(!card.isEmpty() && ItemSecurityCard.hasPermission(card, permission)); } }
@Override public void initGui() { super.initGui(); this.tabIcons = new ResourceLocation(CompactMachines3.MODID, "textures/gui/tabicons.png"); int offsetX = (int)((this.width - this.windowWidth) / 2.0f); int offsetY = (int)((this.height - this.windowHeight) / 2.0f); this.buttonList.clear(); this.guiWhiteListAddButton = new GuiButton(0, offsetX+5+windowWidth-30, offsetY+44, 20, 20, "+"); this.buttonList.add(this.guiWhiteListAddButton); this.guiMachineLockedButton = new GuiCheckBox(1, offsetX+7, offsetY + 7, "", GuiMachineData.locked); this.buttonList.add(this.guiMachineLockedButton); this.guiWhiteListInput = new GuiTextField(0, this.fontRenderer, offsetX+6, offsetY+45, windowWidth-33, 18); this.guiWhiteList = new GuiMachinePlayerWhitelist(this, offsetY+65, offsetY+windowHeight - 5, offsetX+5, 20, windowWidth - 10, windowHeight); this.guiEnterButton = new GuiButton(2, offsetX+5+windowWidth-30, offsetY+windowHeight-25, 20, 20, ""); this.buttonList.add(this.guiEnterButton); }