net.minecraft.client.audio.SoundHandler Java Examples
The following examples show how to use
net.minecraft.client.audio.SoundHandler.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClientProxy.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
@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); } } }
Example #2
Source File: DMChatHandler.java From Hyperium with GNU Lesser General Public License v3.0 | 6 votes |
@Override public boolean chatReceived(IChatComponent component, String text) { if (!Settings.PING_ON_DM) return false; Matcher matcher = regexPatterns.get(ChatRegexType.PRIVATE_MESSAGE_FROM).matcher(text); if (matcher.matches()) { SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler(); if (soundHandler != null && Minecraft.getMinecraft().theWorld != null) { soundHandler.playSound(PositionedSoundRecord.create(new ResourceLocation("note.pling"), (float) Minecraft.getMinecraft().thePlayer.posX, (float) Minecraft.getMinecraft().thePlayer.posY, (float) Minecraft.getMinecraft().thePlayer.posZ)); } } return false; }
Example #3
Source File: HypixelDetector.java From Hyperium with GNU Lesser General Public License v3.0 | 6 votes |
@InvokeEvent public void join(JoinHypixelEvent event) { if (Settings.HYPIXEL_ZOO) { Hyperium.INSTANCE.getNotification().display("Welcome to the Hypixel Zoo.", "Click to visit https://hypixel.net/", 5f, null, () -> { try { Desktop.getDesktop().browse(new URI("https://hypixel.net/")); } catch (IOException | URISyntaxException e) { e.printStackTrace(); } }, new Color(200, 150, 50)); SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler(); if (soundHandler == null || Minecraft.getMinecraft().theWorld == null) return; soundHandler.playSound(PositionedSoundRecord.create(new ResourceLocation("zoo"), (float) Minecraft.getMinecraft().thePlayer.posX, (float) Minecraft.getMinecraft().thePlayer.posY, (float) Minecraft.getMinecraft().thePlayer.posZ)); } }
Example #4
Source File: MessageAddEffects.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
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); } }
Example #5
Source File: GuiCustomButton.java From Custom-Main-Menu with MIT License | 5 votes |
@Override public void playPressSound(SoundHandler soundHandlerIn) { if (b.pressSound != null) { soundHandlerIn.playSound(new PositionedSoundRecord(new ResourceLocation(b.pressSound), SoundCategory.MASTER, 1F, 1F, false, 0, AttenuationType.NONE, 0, 0, 0)); } else { super.playPressSound(soundHandlerIn); } }
Example #6
Source File: GuiKnappingButton.java From TFC2 with GNU General Public License v3.0 | 5 votes |
@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)); }
Example #7
Source File: ButtonSolid.java From SkyblockAddons with MIT License | 4 votes |
@Override public void playPressSound(SoundHandler soundHandlerIn) { if (feature != Feature.WARNING_TIME) super.playPressSound(soundHandlerIn); }
Example #8
Source File: AbstractSlider.java From BoundingBoxOutlineReloaded with MIT License | 4 votes |
@Override public void playDownSound(SoundHandler soundHandler) { }
Example #9
Source File: SoundFixWrapper.java From Valkyrien-Skies with Apache License 2.0 | 4 votes |
@Override public SoundEventAccessor createAccessor(SoundHandler handler) { return wrappedSound.createAccessor(handler); }
Example #10
Source File: ClientOnlyProxy.java From EmergingTechnology with MIT License | 4 votes |
@Override public void init(FMLInitializationEvent event) { super.init(event); MinecraftForge.EVENT_BUS.register(SoundHandler.class); }
Example #11
Source File: ButtonSwitchTab.java From SkyblockAddons with MIT License | 4 votes |
@Override public void playPressSound(SoundHandler soundHandlerIn) { if (currentTab != tab) super.playPressSound(soundHandlerIn); }
Example #12
Source File: ButtonNormal.java From SkyblockAddons with MIT License | 4 votes |
@Override public void playPressSound(SoundHandler soundHandlerIn) { if (feature == Feature.LANGUAGE || feature == Feature.EDIT_LOCATIONS || feature == Feature.GENERAL_SETTINGS) { super.playPressSound(soundHandlerIn); } }
Example #13
Source File: ButtonLocation.java From SkyblockAddons with MIT License | 4 votes |
@Override public void playPressSound(SoundHandler soundHandlerIn) {}
Example #14
Source File: ButtonNewTag.java From SkyblockAddons with MIT License | 4 votes |
@Override public void playPressSound(SoundHandler soundHandlerIn) { }
Example #15
Source File: ButtonModify.java From SkyblockAddons with MIT License | 4 votes |
@Override public void playPressSound(SoundHandler soundHandlerIn) { if (!hitMaximum()) { super.playPressSound(soundHandlerIn); } }
Example #16
Source File: ButtonArrow.java From SkyblockAddons with MIT License | 4 votes |
@Override public void playPressSound(SoundHandler soundHandlerIn) { if (!max) { super.playPressSound(soundHandlerIn); } }
Example #17
Source File: IComponentParent.java From OpenModsLib with MIT License | votes |
public SoundHandler getSoundHandler();