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


Java SoundManager类代码示例

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


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

示例1: clientTick

import net.minecraft.client.audio.SoundManager; //导入依赖的package包/类
@SubscribeEvent
public static void clientTick(final TickEvent.ClientTickEvent event) {
	// Make sure that the display is created.  OpenEye says that sometimes it isn't.
	if (ModOptions.muteWhenBackground && Display.isCreated()) {
		final SoundManager mgr = Minecraft.getMinecraft().getSoundHandler().sndManager;
		if (mgr instanceof SoundManagerReplacement) {
			final SoundManagerReplacement sm = (SoundManagerReplacement) mgr;

			final boolean active = Display.isActive();
			final boolean muted = sm.isMuted();

			if (active && muted) {
				sm.setMuted(false);
				DSurround.log().info("Unmuting sounds");
			} else if (!active && !muted) {
				sm.setMuted(true);
				DSurround.log().info("Muting sounds");
			}
		}
	}
}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:22,代码来源:BackgroundMute.java

示例2: tickEnd

import net.minecraft.client.audio.SoundManager; //导入依赖的package包/类
@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData) {
	boolean keepLines = false;
	if (mc.thePlayer != null) {
		ItemStack helmet = mc.thePlayer.getCurrentItemOrArmor(4);
		if (helmet != null && helmet.getItem() instanceof ItemSmartHelmet) {
			keepLines = true;
		}
	}
	
	if (!keepLines) ItemSmartHelmet.clientLines = new String[ItemSmartHelmet.LINES];
	
	while (speechQueue.size() > 0) {
		ThreadSpeechProvider thread = speechQueue.remove(0);
		
		try {
			SoundManager.sndSystem.newSource(false, thread.source, thread.file.toURI().toURL(), thread.source, false, (float)thread.x, (float)thread.y, (float)thread.z, 2, 16.0F);
			SoundManager.sndSystem.play(thread.source);
		} catch (Throwable e) {}
		
		thread.unlock();
	}
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:24,代码来源:TickHandlerClient.java

示例3: PlaySoundEvent

import net.minecraft.client.audio.SoundManager; //导入依赖的package包/类
public PlaySoundEvent(SoundManager manager, ISound sound)
{
    super(manager);
    this.sound = sound;
    this.name = sound.getSoundLocation().getResourcePath();
    this.setResultSound(sound);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:8,代码来源:PlaySoundEvent.java

示例4: SoundSourceEvent

import net.minecraft.client.audio.SoundManager; //导入依赖的package包/类
public SoundSourceEvent(SoundManager manager, ISound sound, String uuid)
{
    super(manager);
    this.name = sound.getSoundLocation().getResourcePath();
    this.sound = sound;
    this.uuid = uuid;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:8,代码来源:SoundEvent.java

示例5: canAddSound

import net.minecraft.client.audio.SoundManager; //导入依赖的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

示例6: playSound

import net.minecraft.client.audio.SoundManager; //导入依赖的package包/类
public static ISound playSound(SoundManager manager, ISound sound)
{
    SoundEventAccessorComposite accessor = manager.field_148622_c.func_147680_a(sound.func_147650_b());
    PlaySoundEvent17 e = new PlaySoundEvent17(manager, sound, (accessor == null ? null : accessor.func_148728_d()));
    MinecraftForge.EVENT_BUS.post(e);
    return e.result;
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:8,代码来源:ForgeHooksClient.java

示例7: PlaySoundEvent

import net.minecraft.client.audio.SoundManager; //导入依赖的package包/类
public PlaySoundEvent(SoundManager manager, SoundPoolEntry source, String name, float x, float y, float z, float volume, float pitch)
{ 
    super(manager, source, name, volume, pitch);
    this.x = x;
    this.y = y;
    this.z = z;
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:8,代码来源:PlaySoundEvent.java

示例8: SoundSourceEvent

import net.minecraft.client.audio.SoundManager; //导入依赖的package包/类
public SoundSourceEvent(SoundManager manager, ISound sound, String uuid)
{
    super(manager);
    this.name = sound.func_147650_b().func_110623_a();
    this.sound = sound;
    this.uuid = uuid;
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:8,代码来源:SoundEvent.java

示例9: SoundResultEvent

import net.minecraft.client.audio.SoundManager; //导入依赖的package包/类
public SoundResultEvent(SoundManager manager, SoundPoolEntry source, String name, float volume, float pitch)
{
    super(manager);
    this.manager = manager;
    this.source = source;
    this.name = name;
    this.volume = volume;
    this.pitch = pitch;
    this.result = source;
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:11,代码来源:SoundResultEvent.java

示例10: PlayStreamingEvent

import net.minecraft.client.audio.SoundManager; //导入依赖的package包/类
public PlayStreamingEvent(SoundManager manager, SoundPoolEntry source, String name, float x, float y, float z)
{ 
    super(manager, source, name, 0.0f, 0.0f);
    this.x = x;
    this.y = y;
    this.z = z;
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:8,代码来源:PlayStreamingEvent.java

示例11: PlaySoundEvent17

import net.minecraft.client.audio.SoundManager; //导入依赖的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;
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:9,代码来源:PlaySoundEvent17.java

示例12: PlaySoundSourceEvent

import net.minecraft.client.audio.SoundManager; //导入依赖的package包/类
@Deprecated
public PlaySoundSourceEvent(SoundManager manager, String name, float x, float y, float z)
{
    super(manager, null, null);
    this.manager = manager;
    this.name = name;
    this.x = x;
    this.y = y;
    this.z = z;
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:11,代码来源:PlaySoundSourceEvent.java

示例13: PlayStreamingSourceEvent

import net.minecraft.client.audio.SoundManager; //导入依赖的package包/类
@Deprecated
public PlayStreamingSourceEvent(SoundManager manager, String name, float x, float y, float z)
{
    super(manager, null, null);
    this.manager = manager;
    this.name = name;
    this.x = x;
    this.y = y;
    this.z = z;
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:11,代码来源:PlayStreamingSourceEvent.java

示例14: playSound

import net.minecraft.client.audio.SoundManager; //导入依赖的package包/类
@Nullable
public String playSound(@Nonnull final BasicSound<?> sound) {
	if (!canFitSound()) {
		if (ModOptions.enableDebugLogging)
			DSurround.log().debug("> NO ROOM: [%s]", sound.toString());
		return null;
	}

	final SoundManager manager = getManager();
	
	if (!StringUtils.isEmpty(sound.getId()))
		manager.stopSound(sound);

	manager.playSound(sound);

	if (ModOptions.enableDebugLogging) {
		if (StringUtils.isEmpty(sound.getId())) {
			DSurround.log().debug("> NOT QUEUED: [%s]", sound.toString());
		} else {
			final StringBuilder builder = new StringBuilder();
			builder.append("> QUEUED: [").append(sound.toString()).append(']');
			if (DSurround.log().testTrace(ModOptions.Trace.TRUE_SOUND_VOLUME)) {
				final SoundSystem ss = manager.sndSystem;
				// Force a flush of all commands so we can get
				// the actual volume and pitch used within the
				// sound library.
				ss.CommandQueue(null);
				final float v = ss.getVolume(sound.getId());
				final float p = ss.getPitch(sound.getId());
				builder.append("; v: ").append(v).append(", p: ").append(p);
			}
			DSurround.log().debug(builder.toString());
		}
	}

	return sound.getId();
}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:38,代码来源:SoundEngine.java

示例15: playSound

import net.minecraft.client.audio.SoundManager; //导入依赖的package包/类
public static ISound playSound(SoundManager manager, ISound sound)
{
    SoundEventAccessorComposite accessor = manager.sndHandler.getSound(sound.getPositionedSoundLocation());
    PlaySoundEvent17 e = new PlaySoundEvent17(manager, sound, (accessor == null ? null : accessor.getSoundCategory()));
    MinecraftForge.EVENT_BUS.post(e);
    return e.result;
}
 
开发者ID:alexandrage,项目名称:CauldronGit,代码行数:8,代码来源:ForgeHooksClient.java


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