/** * 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. */ public void initGui() { int i = 0; this.field_146507_a = I18n.format("options.sounds.title", new Object[0]); this.field_146508_h = I18n.format("options.off", new Object[0]); this.buttonList.add(new GuiScreenOptionsSounds.Button(SoundCategory.MASTER.getCategoryId(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1), SoundCategory.MASTER, true)); i = i + 2; for (SoundCategory soundcategory : SoundCategory.values()) { if (soundcategory != SoundCategory.MASTER) { this.buttonList.add(new GuiScreenOptionsSounds.Button(soundcategory.getCategoryId(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1), soundcategory, false)); ++i; } } this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.format("gui.done", new Object[0]))); }
public void mouseReleased(int mouseX, int mouseY) { if (this.field_146155_p) { if (this.field_146153_r == SoundCategory.MASTER) { float f = 1.0F; } else { GuiScreenOptionsSounds.this.game_settings_4.getSoundLevel(this.field_146153_r); } GuiScreenOptionsSounds.this.mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); } this.field_146155_p = false; }
/** * Adds the buttons (and other controls) to the screen in question. */ public void initGui() { byte var1 = 0; this.field_146507_a = I18n.format("options.sounds.title", new Object[0]); this.field_146508_h = I18n.format("options.off", new Object[0]); this.buttonList.add(new GuiScreenOptionsSounds.Button(SoundCategory.MASTER.getCategoryId(), this.width / 2 - 155 + var1 % 2 * 160, this.height / 6 - 12 + 24 * (var1 >> 1), SoundCategory.MASTER, true)); int var6 = var1 + 2; SoundCategory[] var2 = SoundCategory.values(); int var3 = var2.length; for (int var4 = 0; var4 < var3; ++var4) { SoundCategory var5 = var2[var4]; if (var5 != SoundCategory.MASTER) { this.buttonList.add(new GuiScreenOptionsSounds.Button(var5.getCategoryId(), this.width / 2 - 155 + var6 % 2 * 160, this.height / 6 - 12 + 24 * (var6 >> 1), var5, false)); ++var6; } } this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.format("gui.done", new Object[0]))); }
public void mouseReleased(int p_146118_1_, int p_146118_2_) { if (this.field_146155_p) { if (this.field_146153_r == SoundCategory.MASTER) { float var10000 = 1.0F; } else { GuiScreenOptionsSounds.this.field_146506_g.getSoundLevel(this.field_146153_r); } GuiScreenOptionsSounds.this.mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); } this.field_146155_p = false; }
@Override public void useNetworkData(EntityPlayer player, Side side, byte id, NBTTagCompound nbt) { if(side.isClient()) { if(id == 3) { ForgeDirection dir = RotatableBlock.getFront(this.getBlockMetadata()); worldObj.playSound(xCoord + dir.offsetX, yCoord + 5, zCoord + dir.offsetZ, "advancedrocketry:railgunBang", Minecraft.getMinecraft().gameSettings.getSoundLevel(SoundCategory.BLOCKS), 0.975f + worldObj.rand.nextFloat()*0.05f, false); recoil = worldObj.getTotalWorldTime(); } } else if(id == 4) { minStackTransferSize = nbt.getInteger("minTransferSize"); } else if(id == 5) { state = RedstoneState.values()[nbt.getByte("state")]; } else super.useNetworkData(player, side, id, nbt); }
public void initGui() { byte b0 = 0; this.field_146507_a = I18n.format("options.sounds.title", new Object[0]); this.field_146508_h = I18n.format("options.off", new Object[0]); this.buttonList.add(new GuiScreenOptionsSounds.Button(SoundCategory.MASTER.getCategoryId(), this.width / 2 - 155 + b0 % 2 * 160, this.height / 6 - 12 + 24 * (b0 >> 1), SoundCategory.MASTER, true)); int k = b0 + 2; SoundCategory[] asoundcategory = SoundCategory.values(); int i = asoundcategory.length; for (int j = 0; j < i; ++j) { SoundCategory soundcategory = asoundcategory[j]; if (soundcategory != SoundCategory.MASTER) { this.buttonList.add(new GuiScreenOptionsSounds.Button(soundcategory.getCategoryId(), this.width / 2 - 155 + k % 2 * 160, this.height / 6 - 12 + 24 * (k >> 1), soundcategory, false)); ++k; } } this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.format("gui.done", new Object[0]))); }
public void mouseReleased(int p_146118_1_, int p_146118_2_) { if (this.field_146155_p) { if (this.field_146153_r == SoundCategory.MASTER) { float f = 1.0F; } else { GuiScreenOptionsSounds.this.field_146506_g.getSoundLevel(this.field_146153_r); } GuiScreenOptionsSounds.this.mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); } this.field_146155_p = false; }
public Button(int p_i45024_2_, int p_i45024_3_, int p_i45024_4_, SoundCategory p_i45024_5_, boolean p_i45024_6_) { super(p_i45024_2_, p_i45024_3_, p_i45024_4_, p_i45024_6_ ? 310 : 150, 20, ""); this.field_146153_r = p_i45024_5_; this.field_146152_s = I18n.format("soundCategory." + p_i45024_5_.getCategoryName(), new Object[0]); this.displayString = this.field_146152_s + ": " + GuiScreenOptionsSounds.this.getSoundVolume(p_i45024_5_); this.field_146156_o = GuiScreenOptionsSounds.this.game_settings_4.getSoundLevel(p_i45024_5_); }
@SubscribeEvent @SideOnly(Side.CLIENT) public void onSoundPlay(PlaySoundEvent17 event) { if (this.mc.thePlayer != null && mc.thePlayer.dimension == Main.DIM_ID && event.category == SoundCategory.MUSIC) event.manager.setSoundCategoryVolume(SoundCategory.MUSIC, 0); }
public PlaySoundEvent17(SoundManager manager, ISound sound, SoundCategory category) { super(manager); this.sound = sound; this.category = category; this.name = sound.func_147650_b().func_110623_a(); this.result = sound; }
public void play() throws UnsupportedAudioFileException, IOException { AudioInputStream in = (AudioInputStream) this.stream; final AudioFormat outFormat = getOutFormat(in.getFormat()); this.source = BufferUtils.createIntBuffer(1); AL10.alGenSources(this.source); if (alError()) { close(); return; } AL10.alSourcei(this.source.get(0), AL10.AL_LOOPING, AL10.AL_FALSE); AL10.alSourcef(this.source.get(0), AL10.AL_PITCH, 1.0f); AL10.alSourcef(this.source.get(0), AL10.AL_GAIN, this.volume * Minecraft.getMinecraft().gameSettings.getSoundLevel(SoundCategory.RECORDS)); if (alError()) { close(); return; } this.playing = true; if (this.listener != null) { this.listener.playbackStarted(createEvent(PlaybackEvent.STARTED)); } stream(AudioSystem.getAudioInputStream(outFormat, in)); if (this.playing) { while (AL10.alGetSourcei(this.source.get(0), AL10.AL_SOURCE_STATE) == AL10.AL_PLAYING) { try { Thread.sleep(1); } catch (InterruptedException e) {} } } close(); }
public float getVolume() { if (this.player != null) return this.player.getVolume() / Minecraft.getMinecraft().gameSettings.getSoundLevel(SoundCategory.RECORDS); else return 0; }
public PlaySoundEvent17(SoundManager manager, ISound sound, SoundCategory category) { super(manager); this.sound = sound; this.category = category; this.name = sound.getPositionedSoundLocation().getResourcePath(); this.result = sound; }
public Button(int p_i45024_2_, int p_i45024_3_, int p_i45024_4_, SoundCategory p_i45024_5_, boolean p_i45024_6_) { super(p_i45024_2_, p_i45024_3_, p_i45024_4_, p_i45024_6_ ? 310 : 150, 20, ""); this.field_146153_r = p_i45024_5_; this.field_146152_s = I18n.format("soundCategory." + p_i45024_5_.getCategoryName(), new Object[0]); this.displayString = this.field_146152_s + ": " + GuiScreenOptionsSounds.this.func_146504_a(p_i45024_5_); this.field_146156_o = GuiScreenOptionsSounds.this.field_146506_g.getSoundLevel(p_i45024_5_); }
@Override public float getSoundVolume(int category) { if (category > SoundCategory.values().length) { return 0; } return FMLClientHandler.instance().getClient().gameSettings.getSoundLevel(SoundCategory.values()[category]); }
public float getSoundLevel(SoundCategory p_151438_1_) { return this.mapSoundLevels.containsKey(p_151438_1_) ? ((Float)this.mapSoundLevels.get(p_151438_1_)).floatValue() : 1.0F; }
public void setSoundLevel(SoundCategory p_151439_1_, float p_151439_2_) { this.mc.getSoundHandler().setSoundLevel(p_151439_1_, p_151439_2_); this.mapSoundLevels.put(p_151439_1_, Float.valueOf(p_151439_2_)); }
protected String getSoundVolume(SoundCategory p_146504_1_) { float f = this.game_settings_4.getSoundLevel(p_146504_1_); return f == 0.0F ? this.field_146508_h : (int)(f * 100.0F) + "%"; }
/** * 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. */ public void initGui() { int i = 0; this.field_146442_a = I18n.format("options.title", new Object[0]); for (GameSettings.Options gamesettings$options : field_146440_f) { if (gamesettings$options.getEnumFloat()) { this.buttonList.add(new GuiOptionSlider(gamesettings$options.returnEnumOrdinal(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1), gamesettings$options)); } else { 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)); this.buttonList.add(guioptionbutton); } ++i; } if (this.mc.theWorld != null) { EnumDifficulty enumdifficulty = this.mc.theWorld.getDifficulty(); 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)); this.buttonList.add(this.field_175357_i); if (this.mc.isSingleplayer() && !this.mc.theWorld.getWorldInfo().isHardcoreModeEnabled()) { this.field_175357_i.setWidth(this.field_175357_i.getButtonWidth() - 20); this.field_175356_r = new GuiLockIconButton(109, this.field_175357_i.xPosition + this.field_175357_i.getButtonWidth(), this.field_175357_i.yPosition); this.buttonList.add(this.field_175356_r); this.field_175356_r.func_175229_b(this.mc.theWorld.getWorldInfo().isDifficultyLocked()); this.field_175356_r.enabled = !this.field_175356_r.func_175230_c(); this.field_175357_i.enabled = !this.field_175356_r.func_175230_c(); } else { this.field_175357_i.enabled = false; } } this.buttonList.add(new GuiButton(110, this.width / 2 - 155, this.height / 6 + 48 - 6, 150, 20, I18n.format("options.skinCustomisation", new Object[0]))); this.buttonList.add(new GuiButton(8675309, this.width / 2 + 5, this.height / 6 + 48 - 6, 150, 20, "Super Secret Settings...") { public void playPressSound(SoundHandler soundHandlerIn) { SoundEventAccessorComposite soundeventaccessorcomposite = soundHandlerIn.getRandomSoundFromCategories(new SoundCategory[] {SoundCategory.ANIMALS, SoundCategory.BLOCKS, SoundCategory.MOBS, SoundCategory.PLAYERS, SoundCategory.WEATHER}); if (soundeventaccessorcomposite != null) { soundHandlerIn.playSound(PositionedSoundRecord.create(soundeventaccessorcomposite.getSoundEventLocation(), 0.5F)); } } }); this.buttonList.add(new GuiButton(106, this.width / 2 - 155, this.height / 6 + 72 - 6, 150, 20, I18n.format("options.sounds", new Object[0]))); this.buttonList.add(new GuiButton(107, this.width / 2 + 5, this.height / 6 + 72 - 6, 150, 20, I18n.format("options.stream", new Object[0]))); this.buttonList.add(new GuiButton(101, this.width / 2 - 155, this.height / 6 + 96 - 6, 150, 20, I18n.format("options.video", new Object[0]))); this.buttonList.add(new GuiButton(100, this.width / 2 + 5, this.height / 6 + 96 - 6, 150, 20, I18n.format("options.controls", new Object[0]))); this.buttonList.add(new GuiButton(102, this.width / 2 - 155, this.height / 6 + 120 - 6, 150, 20, I18n.format("options.language", new Object[0]))); this.buttonList.add(new GuiButton(103, this.width / 2 + 5, this.height / 6 + 120 - 6, 150, 20, I18n.format("options.chat.title", new Object[0]))); this.buttonList.add(new GuiButton(105, this.width / 2 - 155, this.height / 6 + 144 - 6, 150, 20, I18n.format("options.resourcepack", new Object[0]))); this.buttonList.add(new GuiButton(104, this.width / 2 + 5, this.height / 6 + 144 - 6, 150, 20, I18n.format("options.snooper.view", new Object[0]))); this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.format("gui.done", new Object[0]))); }