net.minecraft.client.audio.PositionedSoundRecord Java Examples

The following examples show how to use net.minecraft.client.audio.PositionedSoundRecord. 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: HypixelDetector.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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 #2
Source File: DMChatHandler.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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: GuiUpdates.java    From VersionChecker with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void openInfoScreen(Update update)
{
    openUpdate = update;
    updateButton.visible = true;
    closeButton.visible = true;
    changeLogList.disableInput = false;
    updateList.disableInput = true;
    buttonDownloaded.setUpdate(update);
    Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.ui_button_click, 1.0F));
    if (update.isDirectLink)
    {
        updateButton.displayString = I18n.translateToLocal(Strings.UPDATE);
        updateButton.enabled = update.updateURL != null && !update.isDownloaded();
    }
    else
    {
        updateButton.displayString = I18n.translateToLocal(Strings.OPEN_WEBPAGE);
        updateButton.enabled = update.updateURL != null;
    }
    if (openUpdate.changeLog != null)
    {
        changeLogList.setText(openUpdate.changeLog);
    }
    tempDisableButtonPress = 5;
}
 
Example #4
Source File: ClientProxy.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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 #5
Source File: BackgroundMusicHandler.java    From TFC2 with GNU General Public License v3.0 6 votes vote down vote up
@SubscribeEvent
public void onBGMusic(PlaySoundEvent event)
{
	if(event.getSound() != null && event.getSound().getCategory() != null && event.getSound().getCategory() == SoundCategory.MUSIC)
	{
		if(event.getManager().isSoundPlaying(iSound))
		{
			event.setResultSound(null);
		}
		else
		{
			iSound = PositionedSoundRecord.getMusicRecord(TFC_Sounds.TFCMUSIC);
			event.setResultSound(iSound);
		}
	}
}
 
Example #6
Source File: GuiCustomLabel.java    From Custom-Main-Menu with MIT License 6 votes vote down vote up
public void mouseClicked(int mouseX, int mouseY, int mouseButton)
{
	boolean flag = isMouseAboveLabel(mouseX, mouseY);

	if (flag && text.action != null)
	{
		if (text.pressSound != null)
		{
			Minecraft.getMinecraft().getSoundHandler().playSound(new PositionedSoundRecord(new ResourceLocation(text.pressSound), SoundCategory.MASTER, 1F, 1F, false, 0, AttenuationType.NONE, 0, 0, 0));
		}
		else
		{
			Minecraft.getMinecraft().getSoundHandler().playSound(new PositionedSoundRecord(new ResourceLocation("ui.button.click"), SoundCategory.MASTER, 1F, 1F, false, 0, AttenuationType.NONE, 0, 0, 0));
		}

		text.action.perform(this.text, parent);
	}
}
 
Example #7
Source File: YouCouldMakeAReligionOutOfThis.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
@SubscribeEvent
@SideOnly(Side.CLIENT)
public static void onClientTick(TickEvent.ClientTickEvent event) {
    if (event.phase == TickEvent.Phase.START) {
        Minecraft client = Minecraft.getMinecraft();
        if (client.world != null && !client.isGamePaused()) {
            RANDOM.setSeed((client.world.getTotalWorldTime() * M) ^ client.world.getSeed());
            if (RANDOM.nextInt(CHANCE) == 0) {
                ISound sound = PositionedSoundRecord.getMasterRecord(YOU_COULD_MAKE_A_RELIGION_OUT_OF_THIS, 1.0F);
                client.getSoundHandler().playSound(sound);
            }
        }
    }
}
 
Example #8
Source File: ModuleElement.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
    if(mouseButton == 0 && isHovering(mouseX, mouseY) && isVisible()) {
        module.toggle();
        mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
    }

    if(mouseButton == 1 && isHovering(mouseX, mouseY) && isVisible()) {
        showSettings = !showSettings;
        mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
    }
}
 
Example #9
Source File: Panel.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
    if(!visible)
        return;

    if(mouseButton == 1 && isHovering(mouseX, mouseY)) {
        open = !open;
        mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("random.bow"), 1.0F));
        return;
    }

    for(final Element element : elements)
        if(element.getY() <= getY() + fade)
            element.mouseClicked(mouseX, mouseY, mouseButton);
}
 
Example #10
Source File: MainMenuButton.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
public void mouseRelease(int x, int y, int button) {
    if(inside(x, y) && this.clicked && button == 0) {
        this.action();
        Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0f));
    }

    if(button == 0) {
        this.clicked = false;
    }
}
 
Example #11
Source File: GuiNBTTree.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
private void saveButtonClicked(GuiSaveSlotButton button) {
    if (saveSlots[button.saveId] == null) {
        saveSlots[button.saveId] = this.getNBTTree().toNBTTagCompound();
        button.saved();
        ConfigurationManager.instance().saveConfigs();
        Wrapper.INSTANCE.mc().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0f));
    } else {
        Wrapper.INSTANCE.mc().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0f));
        Wrapper.INSTANCE.mc().displayGuiScreen(new GuiNBTEdit(saveSlots[button.saveId]));
    }
}
 
Example #12
Source File: GuiCustomButton.java    From Custom-Main-Menu with MIT License 5 votes vote down vote up
@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 #13
Source File: GuiCCButton.java    From CodeChickenCore with MIT License 5 votes vote down vote up
@Override
public void mouseClicked(int x, int y, int button) {
    if (isEnabled && pointInside(x, y) && actionCommand != null) {
        sendAction(actionCommand, button);
        Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
    }
}
 
Example #14
Source File: GuiComponentBook.java    From OpenModsLib with MIT License 4 votes vote down vote up
private void playPageTurnSound() {
	parent.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(Sounds.PAGE_TURN, 1.0f));
}
 
Example #15
Source File: GuiButton.java    From WearableBackpacks with MIT License 4 votes vote down vote up
public void playPressSound() {
	getMC().getSoundHandler().playSound(
		PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
}
 
Example #16
Source File: ScrollBar.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
protected void playPressSound()
{
    this.parent.mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
}
 
Example #17
Source File: NEIClientUtils.java    From NotEnoughItems with MIT License 4 votes vote down vote up
public static void playClickSound() {
    mc().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
}
 
Example #18
Source File: Option.java    From NotEnoughItems with MIT License 4 votes vote down vote up
public static void playClickSound() {
    Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
}
 
Example #19
Source File: NEIClientUtils.java    From NotEnoughItems with MIT License 4 votes vote down vote up
public static void playClickSound() {
    mc().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
}
 
Example #20
Source File: Option.java    From NotEnoughItems with MIT License 4 votes vote down vote up
public static void playClickSound() {
    Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
}
 
Example #21
Source File: Widget.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@SideOnly(Side.CLIENT)
protected void playButtonClickSound() {
    Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
}