Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the window resizes, the buttonList is cleared beforehand.
()
| 34 | * window resizes, the buttonList is cleared beforehand. |
| 35 | */ |
| 36 | public void initGui() |
| 37 | { |
| 38 | int i = 0; |
| 39 | this.field_146442_a = I18n.format("options.title"); |
| 40 | |
| 41 | for (GameSettings.Options gamesettings$options : field_146440_f) |
| 42 | { |
| 43 | if (gamesettings$options.getEnumFloat()) |
| 44 | { |
| 45 | this.buttonList.add(new GuiOptionSlider(gamesettings$options.returnEnumOrdinal(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1), gamesettings$options)); |
| 46 | } |
| 47 | else |
| 48 | { |
| 49 | GuiOptionButton guioptionbutton = new GuiOptionButton(gamesettings$options.returnEnumOrdinal(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1), gamesettings$options, this.game_settings_1.getKeyBinding(gamesettings$options)); |
| 50 | this.buttonList.add(guioptionbutton); |
| 51 | } |
| 52 | |
| 53 | ++i; |
| 54 | } |
| 55 | |
| 56 | if (this.mc.theWorld != null) |
| 57 | { |
| 58 | EnumDifficulty enumdifficulty = this.mc.theWorld.getDifficulty(); |
| 59 | this.field_175357_i = new GuiButton(108, this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1), 150, 20, this.func_175355_a(enumdifficulty)); |
| 60 | this.buttonList.add(this.field_175357_i); |
| 61 | |
| 62 | if (this.mc.isSingleplayer() && !this.mc.theWorld.getWorldInfo().isHardcoreModeEnabled()) |
| 63 | { |
| 64 | this.field_175357_i.setWidth(this.field_175357_i.getButtonWidth() - 20); |
| 65 | this.field_175356_r = new GuiLockIconButton(109, this.field_175357_i.xPosition + this.field_175357_i.getButtonWidth(), this.field_175357_i.yPosition); |
| 66 | this.buttonList.add(this.field_175356_r); |
| 67 | this.field_175356_r.func_175229_b(this.mc.theWorld.getWorldInfo().isDifficultyLocked()); |
| 68 | this.field_175356_r.enabled = !this.field_175356_r.func_175230_c(); |
| 69 | this.field_175357_i.enabled = !this.field_175356_r.func_175230_c(); |
| 70 | } |
| 71 | else |
| 72 | { |
| 73 | this.field_175357_i.enabled = false; |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | this.buttonList.add(new GuiButton(110, this.width / 2 - 155, this.height / 6 + 48 - 6, 150, 20, I18n.format("options.skinCustomisation"))); |
| 78 | this.buttonList.add(new GuiButton(8675309, this.width / 2 + 5, this.height / 6 + 48 - 6, 150, 20, "Super Secret Settings...") |
| 79 | { |
| 80 | public void playPressSound(SoundHandler soundHandlerIn) |
| 81 | { |
| 82 | SoundEventAccessorComposite soundeventaccessorcomposite = soundHandlerIn.getRandomSoundFromCategories(new SoundCategory[] {SoundCategory.ANIMALS, SoundCategory.BLOCKS, SoundCategory.MOBS, SoundCategory.PLAYERS, SoundCategory.WEATHER}); |
| 83 | |
| 84 | if (soundeventaccessorcomposite != null) |
| 85 | { |
| 86 | soundHandlerIn.playSound(PositionedSoundRecord.create(soundeventaccessorcomposite.getSoundEventLocation(), 0.5F)); |
| 87 | } |
| 88 | } |
| 89 | }); |
| 90 | this.buttonList.add(new GuiButton(106, this.width / 2 - 155, this.height / 6 + 72 - 6, 150, 20, I18n.format("options.sounds"))); |
| 91 | this.buttonList.add(new GuiButton(101, this.width / 2 - 155, this.height / 6 + 96 - 6, 150, 20, I18n.format("options.video"))); |
| 92 | this.buttonList.add(new GuiButton(100, this.width / 2 + 5, this.height / 6 + 72 - 6, 150, 20, I18n.format("options.controls"))); |
| 93 | this.buttonList.add(new GuiButton(102, this.width / 2 - 155, this.height / 6 + 120 - 6, 150, 20, I18n.format("options.language"))); |
nothing calls this directly
no test coverage detected