當前位置: 首頁>>代碼示例>>Java>>正文


Java SoundCategory.MASTER屬性代碼示例

本文整理匯總了Java中net.minecraft.util.SoundCategory.MASTER屬性的典型用法代碼示例。如果您正苦於以下問題:Java SoundCategory.MASTER屬性的具體用法?Java SoundCategory.MASTER怎麽用?Java SoundCategory.MASTER使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在net.minecraft.util.SoundCategory的用法示例。


在下文中一共展示了SoundCategory.MASTER屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initGui

/**
 * 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()
{
    this.title = I18n.format("options.sounds.title", new Object[0]);
    this.offDisplayString = I18n.format("options.off", new Object[0]);
    int i = 0;
    this.buttonList.add(new GuiScreenOptionsSounds.Button(SoundCategory.MASTER.ordinal(), 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.ordinal(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1), soundcategory, false));
            ++i;
        }
    }

    int j = this.width / 2 - 75;
    int k = this.height / 6 - 12;
    ++i;
    this.buttonList.add(new GuiOptionButton(201, j, k + 24 * (i >> 1), GameSettings.Options.SHOW_SUBTITLES, this.game_settings_4.getKeyBinding(GameSettings.Options.SHOW_SUBTITLES)));
    this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.format("gui.done", new Object[0])));
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:27,代碼來源:GuiScreenOptionsSounds.java

示例2: setVolume

public void setVolume(SoundCategory category, float volume)
{
    if (this.loaded)
    {
        if (category == SoundCategory.MASTER)
        {
            this.sndSystem.setMasterVolume(volume);
        }
        else
        {
            for (String s : this.categorySounds.get(category))
            {
                ISound isound = (ISound)this.playingSounds.get(s);
                float f = this.getClampedVolume(isound);

                if (f <= 0.0F)
                {
                    this.stopSound(isound);
                }
                else
                {
                    this.sndSystem.setVolume(s, f);
                }
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:27,代碼來源:SoundManager.java

示例3: setSoundLevel

public void setSoundLevel(SoundCategory category, float volume)
{
    if (category == SoundCategory.MASTER && volume <= 0.0F)
    {
        this.stopSounds();
    }

    this.sndManager.setVolume(category, volume);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:9,代碼來源:SoundHandler.java

示例4: start

public PlayedNote start()
{
    //        Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.ENTITY_PIG_AMBIENT, (float)Math.pow(2.0D, (double)((key) - 12 - 48) / 12.0D)));
    //        Minecraft.getMinecraft().getSoundHandler().playSound(sound);
    Minecraft mc = Minecraft.getMinecraft();
    SoundManager soundManager = mc.getSoundHandler().sndManager;
    if (mc.gameSettings.getSoundLevel(SoundCategory.MASTER) > 0.0F && instrument.hasAvailableKey(key))
    {
        instrumentSound.createAccessor(mc.getSoundHandler());

        float f3 = instrumentSound.getVolume();
        float f = 16.0F;

        if (f3 > 1.0F)
        {
            f *= f3;
        }

        SoundCategory soundcategory = instrumentSound.getCategory();
        float f1 = soundManager.getClampedVolume(instrumentSound);

        InstrumentTuning.TuningInfo tuning = instrument.tuning.keyToTuningMap.get(key);
        float f2 = (float)Math.pow(2.0D, (double)tuning.keyOffset / 12.0D);

        soundManager.sndSystem.newSource(false, uniqueId, getURLForSoundResource(instrument, key - tuning.keyOffset), "clef:" + instrument.info.itemName + ":" + (key - tuning.keyOffset) + ".ogg", false, instrumentSound.getXPosF(), instrumentSound.getYPosF(), instrumentSound.getZPosF(), instrumentSound.getAttenuationType().getTypeInt(), f);
        net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlaySoundSourceEvent(soundManager, instrumentSound, uniqueId));

        soundManager.sndSystem.setPitch(uniqueId, f2);
        soundManager.sndSystem.setVolume(uniqueId, f1);
        soundManager.sndSystem.play(uniqueId);
        soundManager.playingSoundsStopTime.put(uniqueId, soundManager.playTime + duration + (int)(instrument.tuning.fadeout * 20F) + 20);
        soundManager.playingSounds.put(uniqueId, instrumentSound);

        if (soundcategory != SoundCategory.MASTER)
        {
            soundManager.categorySounds.put(soundcategory, uniqueId);
        }
        soundManager.tickableSounds.add(instrumentSound);

        played = true;
    }

    return this;
}
 
開發者ID:iChun,項目名稱:Clef,代碼行數:44,代碼來源:PlayedNote.java

示例5: createCustomSound

public static PacketCustomSound createCustomSound(SoundType type) {
    return (PacketCustomSound)new SPacketCustomSound(type.getId(), SoundCategory.MASTER, 0, 0, 0, 1, 1);
}
 
開發者ID:Guichaguri,項目名稱:PacketControl,代碼行數:3,代碼來源:PacketControlFactory.java

示例6: createGameSound

public static PacketGameSound createGameSound(SoundType type) {
    return (PacketGameSound)new SPacketSoundEffect((SoundEvent)type, SoundCategory.MASTER, 0, 0, 0, 1, 1);
}
 
開發者ID:Guichaguri,項目名稱:PacketControl,代碼行數:3,代碼來源:PacketControlFactory.java

示例7: getVolume

private float getVolume(SoundCategory category)
{
    return category != null && category != SoundCategory.MASTER ? this.options.getSoundLevel(category) : 1.0F;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:4,代碼來源:SoundManager.java

示例8: getMasterRecord

public static PositionedSoundRecord getMasterRecord(SoundEvent soundIn, float pitchIn)
{
    return new PositionedSoundRecord(soundIn, SoundCategory.MASTER, 0.25F, pitchIn, false, 0, ISound.AttenuationType.NONE, 0.0F, 0.0F, 0.0F);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:4,代碼來源:PositionedSoundRecord.java


注:本文中的net.minecraft.util.SoundCategory.MASTER屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。