本文整理汇总了Java中net.minecraft.client.audio.SoundHandler.playSound方法的典型用法代码示例。如果您正苦于以下问题:Java SoundHandler.playSound方法的具体用法?Java SoundHandler.playSound怎么用?Java SoundHandler.playSound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.audio.SoundHandler
的用法示例。
在下文中一共展示了SoundHandler.playSound方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: playSound
import net.minecraft.client.audio.SoundHandler; //导入方法依赖的package包/类
@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);
}
}
}
示例2: playHurtSound
import net.minecraft.client.audio.SoundHandler; //导入方法依赖的package包/类
public static void playHurtSound(SoundEvent event, int duration) {
if (!FirstAidConfig.enableSoundSystem)
return;
SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler();
DebuffTimedSound matchingSound = activeSounds.get(event);
if (matchingSound != null) {
if (!matchingSound.isDonePlaying())
soundHandler.stopSound(matchingSound);
activeSounds.remove(event);
}
DebuffTimedSound newSound = new DebuffTimedSound(event, duration);
soundHandler.playSound(newSound);
activeSounds.put(event, newSound);
}
示例3: playPressSound
import net.minecraft.client.audio.SoundHandler; //导入方法依赖的package包/类
@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));
}
示例4: playSoundAtEntity
import net.minecraft.client.audio.SoundHandler; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public static void playSoundAtEntity(Entity entity, byte soundCode)
{
SoundHandler snd = FMLClientHandler.instance().getClient().getSoundHandler();
if (entity instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) entity;
switch (soundCode)
{
case EntitySoundPacket.COPTER_SOUND:
if (ConfigHandler.ALLOW_COPTER_SOUND)
{
snd.playSound(new CopterPackSound(player));
}
break;
case EntitySoundPacket.NYAN_SOUND:
snd.playSound(new NyanMovingSound(player));
break;
case EntitySoundPacket.JETPACK_FIZZ:
snd.playSound(new JetpackSoundOn(player));
break;
case EntitySoundPacket.BOILING_BUBBLES:
snd.playSound(new BoilingBoilerSound(player));
break;
case EntitySoundPacket.LEAKING_STEAM:
snd.playSound(new LeakingBoilerSound(player));
break;
}
}
}
示例5: playPressSound
import net.minecraft.client.audio.SoundHandler; //导入方法依赖的package包/类
public void playPressSound(SoundHandler soundHandlerIn)
{
soundHandlerIn.playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
}
示例6: playPressSound
import net.minecraft.client.audio.SoundHandler; //导入方法依赖的package包/类
@Override
public void playPressSound(SoundHandler soundHandlerIn) {
soundHandlerIn.playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
}
示例7: playPressSound
import net.minecraft.client.audio.SoundHandler; //导入方法依赖的package包/类
@Override
public void playPressSound(SoundHandler soundHandlerIn) {
soundHandlerIn.playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
}
示例8: playPressSound
import net.minecraft.client.audio.SoundHandler; //导入方法依赖的package包/类
public void playPressSound(SoundHandler soundHandlerIn)
{
soundHandlerIn.playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
}
示例9: play
import net.minecraft.client.audio.SoundHandler; //导入方法依赖的package包/类
public static void play(SoundHandler handler, String name) {
if ((OptionCore.SOUND_EFFECTS.getValue()) && (handler != null)) {
handler.playSound(PositionedSoundRecord.create(getResource(name)));
}
}
示例10: playPressSound
import net.minecraft.client.audio.SoundHandler; //导入方法依赖的package包/类
public void playPressSound() {
SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler();
float pitch = enabled ? 1f : 0.5f;
soundHandler.playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, pitch));
}
示例11: playPressSound
import net.minecraft.client.audio.SoundHandler; //导入方法依赖的package包/类
public void playPressSound(float pitch) {
// TODO: Extract the playing of sounds from this class into a QADSoundHandler class.
// That should be done so in the future custom gui screens can have custom sound.
SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler();
soundHandler.playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, pitch));
}
示例12: func_146113_a
import net.minecraft.client.audio.SoundHandler; //导入方法依赖的package包/类
public void func_146113_a(SoundHandler p_146113_1_)
{
p_146113_1_.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
}
示例13: playLoopingSound
import net.minecraft.client.audio.SoundHandler; //导入方法依赖的package包/类
public void playLoopingSound(String resourcelocation, IPitchAndVolumProvider pitchandvolumneprovider) {
SoundHandler sndh = Minecraft.getMinecraft().getSoundHandler();
sndh.playSound(new LoopingSound(new ResourceLocation(resourcelocation), pitchandvolumneprovider));
}
示例14: func_146113_a
import net.minecraft.client.audio.SoundHandler; //导入方法依赖的package包/类
public void func_146113_a(SoundHandler p_146113_1_) {
p_146113_1_.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
}