/** * Called from the main game loop to update the screen. */ public void updateScreen() { MusicTicker musicticker = this.mc.func_181535_r(); SoundHandler soundhandler = this.mc.getSoundHandler(); if (this.field_146581_h == 0) { musicticker.func_181557_a(); musicticker.func_181558_a(MusicTicker.MusicType.CREDITS); soundhandler.resumeSounds(); } soundhandler.update(); ++this.field_146581_h; float f = (float)(this.field_146579_r + this.height + this.height + 24) / this.field_146578_s; if ((float)this.field_146581_h > f) { this.sendRespawnPacket(); } }
@Nullable @Override public SoundEventAccessor createAccessor(@Nonnull SoundHandler handler) { SoundEventAccessor soundEventAccessor = handler.getAccessor(this.soundLocation); if (soundEventAccessor == null) { FirstAid.logger.warn("Missing sound for location " + this.soundLocation); this.sound = SoundHandler.MISSING_SOUND; } else { this.sound = soundEventAccessor.cloneEntry(); } return soundEventAccessor; }
/** * Called from the main game loop to update the screen. */ public void updateScreen() { MusicTicker musicticker = this.mc.getMusicTicker(); SoundHandler soundhandler = this.mc.getSoundHandler(); if (this.time == 0) { musicticker.stopMusic(); musicticker.playMusic(MusicTicker.MusicType.CREDITS); soundhandler.resumeSounds(); } soundhandler.update(); ++this.time; float f = (float)(this.totalScrollLength + this.height + this.height + 24) / 0.5F; if ((float)this.time > f) { this.sendRespawnPacket(); } }
public List<ResourceLocation> getSounds(String filter){ if(soundCache == null){ soundCache = Lists.newArrayList(); SoundRegistry reg = null; try{ reg = ObfuscationReflectionHelper.getPrivateValue(SoundHandler.class, Minecraft.getMinecraft().getSoundHandler(), 4); } catch(Exception e){} if(reg == null)return soundCache; for(ResourceLocation loc : reg.getKeys()){ if(loc.toString().toLowerCase().contains(filter)){ soundCache.add(loc); } } } return soundCache; }
public BasicSound(@Nonnull final ResourceLocation soundResource, @Nonnull final SoundCategory cat) { super(soundResource, cat); this.volumeScale = DEFAULT_SCALE; this.volume = 1F; this.pitch = 1F; this.setPosition(0, 0, 0); this.repeat = false; this.repeatDelay = 0; this.attenuationType = ISound.AttenuationType.LINEAR; // Sounds are not routed by default. Need to be turned on // in a derived class or set via setter. this.route = false; super.sound = SoundHandler.MISSING_SOUND; }
@Override public void onConnect() { this.soundsToBlock.clear(); this.soundCull.clear(); final SoundHandler handler = Minecraft.getMinecraft().getSoundHandler(); for (final Object resource : handler.soundRegistry.getKeys()) { final String rs = resource.toString(); if (this.registry.isSoundBlockedLogical(rs)) { DSurround.log().debug("Blocking sound '%s'", rs); this.soundsToBlock.add(rs); } else if (this.registry.isSoundCulled(rs)) { DSurround.log().debug("Culling sound '%s'", rs); this.soundCull.put(rs, -ModOptions.soundCullingThreshold); } } }
@Override public void playSound(int soundId, float pitch, float volume, boolean repeat, boolean stop, float x, float y, float z) { SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler(); SoundEvent sound = SoundEvent.REGISTRY.getObjectById(soundId); if (sound != null) { if (stop) { soundHandler.stop(sound.getRegistryName().toString(), null); } else { PositionedSoundRecord positionedSound = new PositionedSoundRecord(sound.getSoundName(), SoundCategory.RECORDS, volume, pitch, repeat, 0, AttenuationType.LINEAR, x, y, z); soundHandler.playSound(positionedSound); } } }
public static void playHurtSound(SoundEvent event, int duration) { if (!FirstAidConfig.enableSoundSystem) return; SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler(); DebuffTimedSound matchingSound = activeSounds.get(event); if (matchingSound != null) { if (!matchingSound.isDonePlaying()) soundHandler.stopSound(matchingSound); activeSounds.remove(event); } DebuffTimedSound newSound = new DebuffTimedSound(event, duration); soundHandler.playSound(newSound); activeSounds.put(event, newSound); }
public static boolean canAddSound(final ISound sound) { if (Sounds.playingSounds == null) { Sounds.playingSounds = ReflectionHelper.findField((Class)SoundManager.class, new String[] { "playingSounds", "field_148629_h" }); Sounds.soundMgr = ReflectionHelper.findField((Class)SoundHandler.class, new String[] { "sndManager", "field_147694_f" }); } try { final SoundManager manager = (SoundManager)Sounds.soundMgr.get(Minecraft.getMinecraft().getSoundHandler()); final Map map = (Map)Sounds.playingSounds.get(manager); return !map.containsValue(sound); } catch (IllegalAccessException e) { return false; } }
public void click(SoundHandler handler, boolean flag) { if (flag) { SoundCore.play(handler, SoundCore.MENU_POPUP); } else { SoundCore.play(handler, SoundCore.DIALOG_CLOSE); } }
protected void generateSoundList(final ConfigCategory cat) { cat.setRequiresMcRestart(false); cat.setRequiresWorldRestart(false); final SoundHandler handler = Minecraft.getMinecraft().getSoundHandler(); final List<String> sounds = new ArrayList<String>(); for (final Object resource : handler.soundRegistry.getKeys()) sounds.add(resource.toString()); Collections.sort(sounds); final SoundRegistry registry = RegistryManager.get(RegistryType.SOUND); for (final String sound : sounds) { final Property prop = new Property(sound, "", Property.Type.STRING); prop.setDefaultValue(""); prop.setRequiresMcRestart(false); prop.setRequiresWorldRestart(false); prop.setConfigEntryClass(SoundConfigEntry.class); final StringBuilder builder = new StringBuilder(); if (registry.isSoundBlocked(sound)) builder.append(GuiConstants.TOKEN_BLOCK).append(' '); if (registry.isSoundCulled(sound)) builder.append(GuiConstants.TOKEN_CULL).append(' '); final float v = registry.getVolumeScale(sound); if (v != 1.0F) builder.append((int) (v * 100F)); prop.setValue(builder.toString()); cat.put(sound, prop); } }
@Override public void playPressSound(SoundHandler paramSoundHandler) { PlayerInfo pi = PlayerManagerTFC.getInstance().getClientPlayer(); if(pi.specialCraftingType.getItem() == TFCItems.LooseRock) paramSoundHandler.playSound(net.minecraft.client.audio.PositionedSoundRecord.getMasterRecord(TFC_Sounds.KNAPPING, 1.0F)); }
@SideOnly(Side.CLIENT) public static void playSoundAtEntity(Entity entity, byte soundCode) { SoundHandler snd = FMLClientHandler.instance().getClient().getSoundHandler(); if (entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entity; switch (soundCode) { case EntitySoundPacket.COPTER_SOUND: if (ConfigHandler.ALLOW_COPTER_SOUND) { snd.playSound(new CopterPackSound(player)); } break; case EntitySoundPacket.NYAN_SOUND: snd.playSound(new NyanMovingSound(player)); break; case EntitySoundPacket.JETPACK_FIZZ: snd.playSound(new JetpackSoundOn(player)); break; case EntitySoundPacket.BOILING_BUBBLES: snd.playSound(new BoilingBoilerSound(player)); break; case EntitySoundPacket.LEAKING_STEAM: snd.playSound(new LeakingBoilerSound(player)); break; } } }
protected void processMessage(final MessageAddEffects message, EntityPlayer player, World world, SoundHandler soundHandler) { if (message.effectType == EFFECT_TELEPORT) { if ((message.flags & SOUND) == SOUND) { float pitch = 0.9f + world.rand.nextFloat() * 0.125f + world.rand.nextFloat() * 0.125f; Effects.playSoundClient(world, message.x, message.y, message.z, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.HOSTILE, 0.8f, pitch); } if ((message.flags & PARTICLES) == PARTICLES) { Effects.spawnParticles(world, EnumParticleTypes.PORTAL, message.x, message.y, message.z, message.particleCount, message.offset, message.velocity); } } else if (message.effectType == EFFECT_ENDER_TOOLS) { if ((message.flags & SOUND) == SOUND && Configs.useToolSounds) { Effects.playSoundClient(world, message.x, message.y, message.z, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.HOSTILE, 0.08f, 1.8f); } if ((message.flags & PARTICLES) == PARTICLES && Configs.useToolParticles) { Effects.spawnParticles(world, EnumParticleTypes.PORTAL, message.x, message.y, message.z, message.particleCount, message.offset, message.velocity); } } else if (message.effectType == EFFECT_PARTICLES) { Effects.spawnParticles(world, EnumParticleTypes.getParticleFromId(message.flags), message.x, message.y, message.z, message.particleCount, message.offset, message.velocity); } else if (message.effectType == EFFECT_SOUND_EVENT) { EnderUtilities.proxy.playSound(message.soundEventId, message.pitch, message.volume, message.repeat, message.flags != 0, message.x, message.y, message.z); } }
public void update(SoundHandler handler) { if (isPlaying) { isPlaying = handler.isSoundPlaying(sound); } else { ticks++; } }
public void tickUpdate() { synchronized (events) { final SoundHandler handler = Minecraft.getMinecraft().getSoundHandler(); Iterator<SoundEvent> it = events.iterator(); while (it.hasNext()) { SoundEvent evt = it.next(); evt.update(handler); if (!evt.isAlive()) it.remove(); } } }
public void playPressSound(SoundHandler soundHandlerIn) { }
/** * 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]))); }
public void playPressSound(SoundHandler soundHandlerIn) { soundHandlerIn.playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); }
public SoundHandler getSoundHandler() { return this.mcSoundHandler; }
@Override public void playPressSound(SoundHandler soundHandlerIn) { soundHandlerIn.playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); }
@SideOnly(Side.CLIENT) public static SoundHandler getSoundHandler() { return getMinecraft().getSoundHandler(); }
@Override public void playPressSound(SoundHandler soundHandlerIn) { soundHandlerIn.playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); }