本文整理汇总了Java中net.minecraft.client.audio.SoundCategory类的典型用法代码示例。如果您正苦于以下问题:Java SoundCategory类的具体用法?Java SoundCategory怎么用?Java SoundCategory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SoundCategory类属于net.minecraft.client.audio包,在下文中一共展示了SoundCategory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initGui
import net.minecraft.client.audio.SoundCategory; //导入依赖的package包/类
/**
* 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_146507_a = I18n.format("options.sounds.title", new Object[0]);
this.field_146508_h = I18n.format("options.off", new Object[0]);
this.buttonList.add(new GuiScreenOptionsSounds.Button(SoundCategory.MASTER.getCategoryId(), 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.getCategoryId(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1), soundcategory, false));
++i;
}
}
this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.format("gui.done", new Object[0])));
}
示例2: mouseReleased
import net.minecraft.client.audio.SoundCategory; //导入依赖的package包/类
public void mouseReleased(int mouseX, int mouseY)
{
if (this.field_146155_p)
{
if (this.field_146153_r == SoundCategory.MASTER)
{
float f = 1.0F;
}
else
{
GuiScreenOptionsSounds.this.game_settings_4.getSoundLevel(this.field_146153_r);
}
GuiScreenOptionsSounds.this.mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
}
this.field_146155_p = false;
}
示例3: initGui
import net.minecraft.client.audio.SoundCategory; //导入依赖的package包/类
/**
* Adds the buttons (and other controls) to the screen in question.
*/
public void initGui()
{
byte var1 = 0;
this.field_146507_a = I18n.format("options.sounds.title", new Object[0]);
this.field_146508_h = I18n.format("options.off", new Object[0]);
this.buttonList.add(new GuiScreenOptionsSounds.Button(SoundCategory.MASTER.getCategoryId(), this.width / 2 - 155 + var1 % 2 * 160, this.height / 6 - 12 + 24 * (var1 >> 1), SoundCategory.MASTER, true));
int var6 = var1 + 2;
SoundCategory[] var2 = SoundCategory.values();
int var3 = var2.length;
for (int var4 = 0; var4 < var3; ++var4)
{
SoundCategory var5 = var2[var4];
if (var5 != SoundCategory.MASTER)
{
this.buttonList.add(new GuiScreenOptionsSounds.Button(var5.getCategoryId(), this.width / 2 - 155 + var6 % 2 * 160, this.height / 6 - 12 + 24 * (var6 >> 1), var5, false));
++var6;
}
}
this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.format("gui.done", new Object[0])));
}
示例4: mouseReleased
import net.minecraft.client.audio.SoundCategory; //导入依赖的package包/类
public void mouseReleased(int p_146118_1_, int p_146118_2_)
{
if (this.field_146155_p)
{
if (this.field_146153_r == SoundCategory.MASTER)
{
float var10000 = 1.0F;
}
else
{
GuiScreenOptionsSounds.this.field_146506_g.getSoundLevel(this.field_146153_r);
}
GuiScreenOptionsSounds.this.mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
}
this.field_146155_p = false;
}
示例5: useNetworkData
import net.minecraft.client.audio.SoundCategory; //导入依赖的package包/类
@Override
public void useNetworkData(EntityPlayer player, Side side, byte id,
NBTTagCompound nbt) {
if(side.isClient()) {
if(id == 3) {
ForgeDirection dir = RotatableBlock.getFront(this.getBlockMetadata());
worldObj.playSound(xCoord + dir.offsetX, yCoord + 5, zCoord + dir.offsetZ, "advancedrocketry:railgunBang", Minecraft.getMinecraft().gameSettings.getSoundLevel(SoundCategory.BLOCKS), 0.975f + worldObj.rand.nextFloat()*0.05f, false);
recoil = worldObj.getTotalWorldTime();
}
}
else if(id == 4) {
minStackTransferSize = nbt.getInteger("minTransferSize");
}
else if(id == 5) {
state = RedstoneState.values()[nbt.getByte("state")];
}
else
super.useNetworkData(player, side, id, nbt);
}
示例6: initGui
import net.minecraft.client.audio.SoundCategory; //导入依赖的package包/类
public void initGui()
{
byte b0 = 0;
this.field_146507_a = I18n.format("options.sounds.title", new Object[0]);
this.field_146508_h = I18n.format("options.off", new Object[0]);
this.buttonList.add(new GuiScreenOptionsSounds.Button(SoundCategory.MASTER.getCategoryId(), this.width / 2 - 155 + b0 % 2 * 160, this.height / 6 - 12 + 24 * (b0 >> 1), SoundCategory.MASTER, true));
int k = b0 + 2;
SoundCategory[] asoundcategory = SoundCategory.values();
int i = asoundcategory.length;
for (int j = 0; j < i; ++j)
{
SoundCategory soundcategory = asoundcategory[j];
if (soundcategory != SoundCategory.MASTER)
{
this.buttonList.add(new GuiScreenOptionsSounds.Button(soundcategory.getCategoryId(), this.width / 2 - 155 + k % 2 * 160, this.height / 6 - 12 + 24 * (k >> 1), soundcategory, false));
++k;
}
}
this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.format("gui.done", new Object[0])));
}
示例7: mouseReleased
import net.minecraft.client.audio.SoundCategory; //导入依赖的package包/类
public void mouseReleased(int p_146118_1_, int p_146118_2_)
{
if (this.field_146155_p)
{
if (this.field_146153_r == SoundCategory.MASTER)
{
float f = 1.0F;
}
else
{
GuiScreenOptionsSounds.this.field_146506_g.getSoundLevel(this.field_146153_r);
}
GuiScreenOptionsSounds.this.mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
}
this.field_146155_p = false;
}
示例8: Button
import net.minecraft.client.audio.SoundCategory; //导入依赖的package包/类
public Button(int p_i45024_2_, int p_i45024_3_, int p_i45024_4_, SoundCategory p_i45024_5_, boolean p_i45024_6_)
{
super(p_i45024_2_, p_i45024_3_, p_i45024_4_, p_i45024_6_ ? 310 : 150, 20, "");
this.field_146153_r = p_i45024_5_;
this.field_146152_s = I18n.format("soundCategory." + p_i45024_5_.getCategoryName(), new Object[0]);
this.displayString = this.field_146152_s + ": " + GuiScreenOptionsSounds.this.getSoundVolume(p_i45024_5_);
this.field_146156_o = GuiScreenOptionsSounds.this.game_settings_4.getSoundLevel(p_i45024_5_);
}
示例9: onSoundPlay
import net.minecraft.client.audio.SoundCategory; //导入依赖的package包/类
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onSoundPlay(PlaySoundEvent17 event)
{
if (this.mc.thePlayer != null && mc.thePlayer.dimension == Main.DIM_ID && event.category == SoundCategory.MUSIC)
event.manager.setSoundCategoryVolume(SoundCategory.MUSIC, 0);
}
示例10: PlaySoundEvent17
import net.minecraft.client.audio.SoundCategory; //导入依赖的package包/类
public PlaySoundEvent17(SoundManager manager, ISound sound, SoundCategory category)
{
super(manager);
this.sound = sound;
this.category = category;
this.name = sound.func_147650_b().func_110623_a();
this.result = sound;
}
示例11: play
import net.minecraft.client.audio.SoundCategory; //导入依赖的package包/类
public void play() throws UnsupportedAudioFileException, IOException {
AudioInputStream in = (AudioInputStream) this.stream;
final AudioFormat outFormat = getOutFormat(in.getFormat());
this.source = BufferUtils.createIntBuffer(1);
AL10.alGenSources(this.source);
if (alError()) {
close();
return;
}
AL10.alSourcei(this.source.get(0), AL10.AL_LOOPING, AL10.AL_FALSE);
AL10.alSourcef(this.source.get(0), AL10.AL_PITCH, 1.0f);
AL10.alSourcef(this.source.get(0), AL10.AL_GAIN, this.volume * Minecraft.getMinecraft().gameSettings.getSoundLevel(SoundCategory.RECORDS));
if (alError()) {
close();
return;
}
this.playing = true;
if (this.listener != null)
{
this.listener.playbackStarted(createEvent(PlaybackEvent.STARTED));
}
stream(AudioSystem.getAudioInputStream(outFormat, in));
if (this.playing) {
while (AL10.alGetSourcei(this.source.get(0), AL10.AL_SOURCE_STATE) == AL10.AL_PLAYING) {
try {
Thread.sleep(1);
} catch (InterruptedException e) {}
}
}
close();
}
示例12: getVolume
import net.minecraft.client.audio.SoundCategory; //导入依赖的package包/类
public float getVolume()
{
if (this.player != null)
return this.player.getVolume() / Minecraft.getMinecraft().gameSettings.getSoundLevel(SoundCategory.RECORDS);
else
return 0;
}
示例13: PlaySoundEvent17
import net.minecraft.client.audio.SoundCategory; //导入依赖的package包/类
public PlaySoundEvent17(SoundManager manager, ISound sound, SoundCategory category)
{
super(manager);
this.sound = sound;
this.category = category;
this.name = sound.getPositionedSoundLocation().getResourcePath();
this.result = sound;
}
示例14: Button
import net.minecraft.client.audio.SoundCategory; //导入依赖的package包/类
public Button(int p_i45024_2_, int p_i45024_3_, int p_i45024_4_, SoundCategory p_i45024_5_, boolean p_i45024_6_)
{
super(p_i45024_2_, p_i45024_3_, p_i45024_4_, p_i45024_6_ ? 310 : 150, 20, "");
this.field_146153_r = p_i45024_5_;
this.field_146152_s = I18n.format("soundCategory." + p_i45024_5_.getCategoryName(), new Object[0]);
this.displayString = this.field_146152_s + ": " + GuiScreenOptionsSounds.this.func_146504_a(p_i45024_5_);
this.field_146156_o = GuiScreenOptionsSounds.this.field_146506_g.getSoundLevel(p_i45024_5_);
}
示例15: getSoundVolume
import net.minecraft.client.audio.SoundCategory; //导入依赖的package包/类
@Override
public float getSoundVolume(int category) {
if (category > SoundCategory.values().length) {
return 0;
}
return FMLClientHandler.instance().getClient().gameSettings.getSoundLevel(SoundCategory.values()[category]);
}