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


Java SoundHandler类代码示例

本文整理汇总了Java中net.minecraft.client.audio.SoundHandler的典型用法代码示例。如果您正苦于以下问题:Java SoundHandler类的具体用法?Java SoundHandler怎么用?Java SoundHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SoundHandler类属于net.minecraft.client.audio包,在下文中一共展示了SoundHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateScreen

import net.minecraft.client.audio.SoundHandler; //导入依赖的package包/类
/**
 * Called from the main game loop to update the screen.
 */
public void updateScreen()
{
    MusicTicker musicticker = this.mc.func_181535_r();
    SoundHandler soundhandler = this.mc.getSoundHandler();

    if (this.field_146581_h == 0)
    {
        musicticker.func_181557_a();
        musicticker.func_181558_a(MusicTicker.MusicType.CREDITS);
        soundhandler.resumeSounds();
    }

    soundhandler.update();
    ++this.field_146581_h;
    float f = (float)(this.field_146579_r + this.height + this.height + 24) / this.field_146578_s;

    if ((float)this.field_146581_h > f)
    {
        this.sendRespawnPacket();
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:25,代码来源:GuiWinGame.java

示例2: createAccessor

import net.minecraft.client.audio.SoundHandler; //导入依赖的package包/类
@Nullable
@Override
public SoundEventAccessor createAccessor(@Nonnull SoundHandler handler) {
    SoundEventAccessor soundEventAccessor = handler.getAccessor(this.soundLocation);

    if (soundEventAccessor == null)
    {
        FirstAid.logger.warn("Missing sound for location " + this.soundLocation);
        this.sound = SoundHandler.MISSING_SOUND;
    }
    else
    {
        this.sound = soundEventAccessor.cloneEntry();
    }

    return soundEventAccessor;
}
 
开发者ID:ichttt,项目名称:FirstAid,代码行数:18,代码来源:DebuffTimedSound.java

示例3: updateScreen

import net.minecraft.client.audio.SoundHandler; //导入依赖的package包/类
/**
 * Called from the main game loop to update the screen.
 */
public void updateScreen()
{
    MusicTicker musicticker = this.mc.getMusicTicker();
    SoundHandler soundhandler = this.mc.getSoundHandler();

    if (this.time == 0)
    {
        musicticker.stopMusic();
        musicticker.playMusic(MusicTicker.MusicType.CREDITS);
        soundhandler.resumeSounds();
    }

    soundhandler.update();
    ++this.time;
    float f = (float)(this.totalScrollLength + this.height + this.height + 24) / 0.5F;

    if ((float)this.time > f)
    {
        this.sendRespawnPacket();
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:GuiWinGame.java

示例4: getSounds

import net.minecraft.client.audio.SoundHandler; //导入依赖的package包/类
public List<ResourceLocation> getSounds(String filter){
	if(soundCache == null){
		soundCache = Lists.newArrayList();
		
		SoundRegistry reg = null;
		try{
			reg = ObfuscationReflectionHelper.getPrivateValue(SoundHandler.class, Minecraft.getMinecraft().getSoundHandler(), 4);
		} catch(Exception e){}
		
		if(reg == null)return soundCache;
		
		for(ResourceLocation loc : reg.getKeys()){
			if(loc.toString().toLowerCase().contains(filter)){
				soundCache.add(loc);
			}
		}
	}
	return soundCache;
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:20,代码来源:GuiSoundMuffler.java

示例5: BasicSound

import net.minecraft.client.audio.SoundHandler; //导入依赖的package包/类
public BasicSound(@Nonnull final ResourceLocation soundResource, @Nonnull final SoundCategory cat) {
	super(soundResource, cat);

	this.volumeScale = DEFAULT_SCALE;

	this.volume = 1F;
	this.pitch = 1F;
	this.setPosition(0, 0, 0);
	this.repeat = false;
	this.repeatDelay = 0;
	this.attenuationType = ISound.AttenuationType.LINEAR;

	// Sounds are not routed by default. Need to be turned on
	// in a derived class or set via setter.
	this.route = false;

	super.sound = SoundHandler.MISSING_SOUND;

}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:20,代码来源:BasicSound.java

示例6: onConnect

import net.minecraft.client.audio.SoundHandler; //导入依赖的package包/类
@Override
public void onConnect() {
	this.soundsToBlock.clear();
	this.soundCull.clear();
	final SoundHandler handler = Minecraft.getMinecraft().getSoundHandler();
	for (final Object resource : handler.soundRegistry.getKeys()) {
		final String rs = resource.toString();
		if (this.registry.isSoundBlockedLogical(rs)) {
			DSurround.log().debug("Blocking sound '%s'", rs);
			this.soundsToBlock.add(rs);
		} else if (this.registry.isSoundCulled(rs)) {
			DSurround.log().debug("Culling sound '%s'", rs);
			this.soundCull.put(rs, -ModOptions.soundCullingThreshold);
		}
	}
}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:17,代码来源:SoundCullHandler.java

示例7: 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

示例8: 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

示例9: canAddSound

import net.minecraft.client.audio.SoundHandler; //导入依赖的package包/类
public static boolean canAddSound(final ISound sound) {
    if (Sounds.playingSounds == null) {
        Sounds.playingSounds = ReflectionHelper.findField((Class)SoundManager.class, new String[] { "playingSounds", "field_148629_h" });
        Sounds.soundMgr = ReflectionHelper.findField((Class)SoundHandler.class, new String[] { "sndManager", "field_147694_f" });
    }
    try {
        final SoundManager manager = (SoundManager)Sounds.soundMgr.get(Minecraft.getMinecraft().getSoundHandler());
        final Map map = (Map)Sounds.playingSounds.get(manager);
        return !map.containsValue(sound);
    }
    catch (IllegalAccessException e) {
        return false;
    }
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:15,代码来源:Sounds.java

示例10: click

import net.minecraft.client.audio.SoundHandler; //导入依赖的package包/类
public void click(SoundHandler handler, boolean flag) {
    if (flag) {
        SoundCore.play(handler, SoundCore.MENU_POPUP);
    } else {
        SoundCore.play(handler, SoundCore.DIALOG_CLOSE);
    }
}
 
开发者ID:Tencao,项目名称:SAO-UI---1.8.8,代码行数:8,代码来源:Elements.java

示例11: generateSoundList

import net.minecraft.client.audio.SoundHandler; //导入依赖的package包/类
protected void generateSoundList(final ConfigCategory cat) {
	cat.setRequiresMcRestart(false);
	cat.setRequiresWorldRestart(false);

	final SoundHandler handler = Minecraft.getMinecraft().getSoundHandler();
	final List<String> sounds = new ArrayList<String>();
	for (final Object resource : handler.soundRegistry.getKeys())
		sounds.add(resource.toString());
	Collections.sort(sounds);

	final SoundRegistry registry = RegistryManager.get(RegistryType.SOUND);
	for (final String sound : sounds) {
		final Property prop = new Property(sound, "", Property.Type.STRING);
		prop.setDefaultValue("");
		prop.setRequiresMcRestart(false);
		prop.setRequiresWorldRestart(false);
		prop.setConfigEntryClass(SoundConfigEntry.class);
		final StringBuilder builder = new StringBuilder();
		if (registry.isSoundBlocked(sound))
			builder.append(GuiConstants.TOKEN_BLOCK).append(' ');
		if (registry.isSoundCulled(sound))
			builder.append(GuiConstants.TOKEN_CULL).append(' ');
		final float v = registry.getVolumeScale(sound);
		if (v != 1.0F)
			builder.append((int) (v * 100F));
		prop.setValue(builder.toString());
		cat.put(sound, prop);
	}
}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:30,代码来源:DynSurroundConfigGui.java

示例12: 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

示例13: 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

示例14: processMessage

import net.minecraft.client.audio.SoundHandler; //导入依赖的package包/类
protected void processMessage(final MessageAddEffects message, EntityPlayer player, World world, SoundHandler soundHandler)
{
    if (message.effectType == EFFECT_TELEPORT)
    {
        if ((message.flags & SOUND) == SOUND)
        {
            float pitch = 0.9f + world.rand.nextFloat() * 0.125f + world.rand.nextFloat() * 0.125f;
            Effects.playSoundClient(world, message.x, message.y, message.z, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.HOSTILE, 0.8f, pitch);
        }
        if ((message.flags & PARTICLES) == PARTICLES)
        {
            Effects.spawnParticles(world, EnumParticleTypes.PORTAL, message.x, message.y, message.z, message.particleCount, message.offset, message.velocity);
        }
    }
    else if (message.effectType == EFFECT_ENDER_TOOLS)
    {
        if ((message.flags & SOUND) == SOUND && Configs.useToolSounds)
        {
            Effects.playSoundClient(world, message.x, message.y, message.z, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.HOSTILE, 0.08f, 1.8f);
        }
        if ((message.flags & PARTICLES) == PARTICLES && Configs.useToolParticles)
        {
            Effects.spawnParticles(world, EnumParticleTypes.PORTAL, message.x, message.y, message.z, message.particleCount, message.offset, message.velocity);
        }
    }
    else if (message.effectType == EFFECT_PARTICLES)
    {
        Effects.spawnParticles(world, EnumParticleTypes.getParticleFromId(message.flags), message.x, message.y, message.z, message.particleCount, message.offset, message.velocity);
    }
    else if (message.effectType == EFFECT_SOUND_EVENT)
    {
        EnderUtilities.proxy.playSound(message.soundEventId, message.pitch, message.volume,
                message.repeat, message.flags != 0, message.x, message.y, message.z);
    }
}
 
开发者ID:maruohon,项目名称:enderutilities,代码行数:36,代码来源:MessageAddEffects.java

示例15: update

import net.minecraft.client.audio.SoundHandler; //导入依赖的package包/类
public void update(SoundHandler handler) {
	if (isPlaying) {
		isPlaying = handler.isSoundPlaying(sound);
	} else {
		ticks++;
	}
}
 
开发者ID:OpenMods,项目名称:OpenBlocks,代码行数:8,代码来源:SoundEventsManager.java


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