当前位置: 首页>>代码示例>>Java>>正文


Java SoundHandler.playSound方法代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:maruohon,项目名称:enderutilities,代码行数:21,代码来源:ClientProxy.java

示例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);
}
 
开发者ID:ichttt,项目名称:FirstAid,代码行数:15,代码来源:DebuffTimedSound.java

示例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));
}
 
开发者ID:Deadrik,项目名称:TFC2,代码行数:8,代码来源:GuiKnappingButton.java

示例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;
        }
    }
}
 
开发者ID:Darkona,项目名称:AdventureBackpack2,代码行数:31,代码来源:ClientActions.java

示例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));
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:GuiButton.java

示例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));
}
 
开发者ID:Zundrel,项目名称:Never-Enough-Currency,代码行数:5,代码来源:GuiClearButton.java

示例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));
}
 
开发者ID:boomboompower,项目名称:TextDisplayer,代码行数:5,代码来源:ModernButton.java

示例8: playPressSound

import net.minecraft.client.audio.SoundHandler; //导入方法依赖的package包/类
public void playPressSound(SoundHandler soundHandlerIn)
{
    soundHandlerIn.playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:GuiButton.java

示例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)));
    }
}
 
开发者ID:Tencao,项目名称:SAO-UI---1.8.8,代码行数:6,代码来源:SoundCore.java

示例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));
}
 
开发者ID:tiffit,项目名称:TaleCraft,代码行数:6,代码来源:QADSlider.java

示例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));
}
 
开发者ID:tiffit,项目名称:TaleCraft,代码行数:7,代码来源:QADComponent.java

示例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));
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:5,代码来源:GuiButton.java

示例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));
}
 
开发者ID:tyronx,项目名称:vintagecraft,代码行数:6,代码来源:ClientProxy.java

示例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));
}
 
开发者ID:AnDwHaT5,项目名称:PixelUtilities,代码行数:4,代码来源:PokegearExit.java


注:本文中的net.minecraft.client.audio.SoundHandler.playSound方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。