本文整理匯總了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])));
}
示例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);
}
}
}
}
}
示例3: setSoundLevel
public void setSoundLevel(SoundCategory category, float volume)
{
if (category == SoundCategory.MASTER && volume <= 0.0F)
{
this.stopSounds();
}
this.sndManager.setVolume(category, volume);
}
示例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;
}
示例5: createCustomSound
public static PacketCustomSound createCustomSound(SoundType type) {
return (PacketCustomSound)new SPacketCustomSound(type.getId(), SoundCategory.MASTER, 0, 0, 0, 1, 1);
}
示例6: createGameSound
public static PacketGameSound createGameSound(SoundType type) {
return (PacketGameSound)new SPacketSoundEffect((SoundEvent)type, SoundCategory.MASTER, 0, 0, 0, 1, 1);
}
示例7: getVolume
private float getVolume(SoundCategory category)
{
return category != null && category != SoundCategory.MASTER ? this.options.getSoundLevel(category) : 1.0F;
}
示例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);
}