Java 类net.minecraft.client.audio.SoundManager 实例源码

项目:DynamicSurroundings    文件:BackgroundMute.java   
@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");
            }
        }
    }
}
项目:PeripheralsPlusPlus    文件:TickHandlerClient.java   
@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();
    }
}
项目:CustomWorldGen    文件:PlaySoundEvent.java   
public PlaySoundEvent(SoundManager manager, ISound sound)
{
    super(manager);
    this.sound = sound;
    this.name = sound.getSoundLocation().getResourcePath();
    this.setResultSound(sound);
}
项目:CustomWorldGen    文件:SoundEvent.java   
public SoundSourceEvent(SoundManager manager, ISound sound, String uuid)
{
    super(manager);
    this.name = sound.getSoundLocation().getResourcePath();
    this.sound = sound;
    this.uuid = uuid;
}
项目:ExtraUtilities    文件:Sounds.java   
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;
    }
}
项目:TRHS_Club_Mod_2016    文件:ForgeHooksClient.java   
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;
}
项目:TRHS_Club_Mod_2016    文件:PlaySoundEvent.java   
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;
}
项目:TRHS_Club_Mod_2016    文件:SoundEvent.java   
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;
}
项目:TRHS_Club_Mod_2016    文件:SoundResultEvent.java   
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;
}
项目:TRHS_Club_Mod_2016    文件:PlayStreamingEvent.java   
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;
}
项目:TRHS_Club_Mod_2016    文件:PlaySoundEvent17.java   
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;
}
项目:TRHS_Club_Mod_2016    文件:PlaySoundSourceEvent.java   
@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;
}
项目:TRHS_Club_Mod_2016    文件:PlaySoundSourceEvent.java   
public PlaySoundSourceEvent(SoundManager manager, ISound sound, String uuid)
{
    super(manager, sound, uuid);
    this.name = sound.func_147650_b().func_110623_a();        
    this.manager = manager;
    this.x = this.y = this.z = 0;
}
项目:TRHS_Club_Mod_2016    文件:PlayStreamingSourceEvent.java   
@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;
}
项目:TRHS_Club_Mod_2016    文件:PlayStreamingSourceEvent.java   
public PlayStreamingSourceEvent(SoundManager manager, ISound sound, String uuid)
{
    super(manager, sound, uuid);
    this.x = this.y = this.z = 0;
    this.manager = null;
    this.name = sound.func_147650_b().func_110623_a();
}
项目:DynamicSurroundings    文件:SoundEngine.java   
@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();
}
项目:CauldronGit    文件:ForgeHooksClient.java   
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;
}
项目:CauldronGit    文件:PlaySoundEvent.java   
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;
}
项目:CauldronGit    文件:SoundEvent.java   
public SoundSourceEvent(SoundManager manager, ISound sound, String uuid)
{
    super(manager);
    this.name = sound.getPositionedSoundLocation().getResourcePath();
    this.sound = sound;
    this.uuid = uuid;
}
项目:CauldronGit    文件:SoundResultEvent.java   
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;
}
项目:CauldronGit    文件:PlayStreamingEvent.java   
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;
}
项目:CauldronGit    文件:PlaySoundEvent17.java   
public PlaySoundEvent17(SoundManager manager, ISound sound, SoundCategory category)
{ 
    super(manager);
    this.sound = sound;
    this.category = category;
    this.name = sound.getPositionedSoundLocation().getResourcePath();
    this.result = sound;
}
项目:CauldronGit    文件:PlaySoundSourceEvent.java   
@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;
}
项目:CauldronGit    文件:PlaySoundSourceEvent.java   
public PlaySoundSourceEvent(SoundManager manager, ISound sound, String uuid)
{
    super(manager, sound, uuid);
    this.name = sound.getPositionedSoundLocation().getResourcePath();        
    this.manager = manager;
    this.x = this.y = this.z = 0;
}
项目:CauldronGit    文件:PlayStreamingSourceEvent.java   
@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;
}
项目:CauldronGit    文件:PlayStreamingSourceEvent.java   
public PlayStreamingSourceEvent(SoundManager manager, ISound sound, String uuid)
{
    super(manager, sound, uuid);
    this.x = this.y = this.z = 0;
    this.manager = null;
    this.name = sound.getPositionedSoundLocation().getResourcePath();
}
项目:vsminecraft    文件:SoundHandler.java   
public static SoundManager getSoundManager()
{
    try {
        return (SoundManager)MekanismUtils.getPrivateValue(mc.getSoundHandler(), net.minecraft.client.audio.SoundHandler.class, ObfuscatedNames.SoundHandler_sndManager);
    } catch(Exception e) {
        return null;
    }
}
项目:vsminecraft    文件:SoundHandler.java   
public static Map<ISound, String> getSoundMap()
{
    if(invPlayingSounds == null)
    {
        try {
            invPlayingSounds = (Map<ISound, String>)MekanismUtils.getPrivateValue(getSoundManager(), net.minecraft.client.audio.SoundManager.class, ObfuscatedNames.SoundManager_invPlayingSounds);
        } catch(Exception e) {
            invPlayingSounds = null;
        }
    }

    return invPlayingSounds;
}
项目:EventMod    文件:SoundHandler.java   
private void initialize() {
    try {
        soundManager = (SoundManager) ReflectionHelper.findField(net.minecraft.client.audio.SoundHandler.class, SOUND_MANAGER_MAPPING).get(Minecraft.getMinecraft().getSoundHandler());
        soundSystem = (SoundSystem) ReflectionHelper.findField(SoundManager.class, SOUND_SYSTEM_MAPPING).get(soundManager);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:Cauldron    文件:ForgeHooksClient.java   
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;
}
项目:Cauldron    文件:PlaySoundEvent.java   
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;
}
项目:Cauldron    文件:SoundEvent.java   
public SoundSourceEvent(SoundManager manager, ISound sound, String uuid)
{
    super(manager);
    this.name = sound.getPositionedSoundLocation().getResourcePath();
    this.sound = sound;
    this.uuid = uuid;
}
项目:Cauldron    文件:SoundResultEvent.java   
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;
}
项目:Cauldron    文件:PlayStreamingEvent.java   
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;
}
项目:Cauldron    文件:PlaySoundEvent17.java   
public PlaySoundEvent17(SoundManager manager, ISound sound, SoundCategory category)
{ 
    super(manager);
    this.sound = sound;
    this.category = category;
    this.name = sound.getPositionedSoundLocation().getResourcePath();
    this.result = sound;
}
项目:Cauldron    文件:PlaySoundSourceEvent.java   
@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;
}
项目:Cauldron    文件:PlaySoundSourceEvent.java   
public PlaySoundSourceEvent(SoundManager manager, ISound sound, String uuid)
{
    super(manager, sound, uuid);
    this.name = sound.getPositionedSoundLocation().getResourcePath();        
    this.manager = manager;
    this.x = this.y = this.z = 0;
}
项目:Cauldron    文件:PlayStreamingSourceEvent.java   
@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;
}
项目:Cauldron    文件:PlayStreamingSourceEvent.java   
public PlayStreamingSourceEvent(SoundManager manager, ISound sound, String uuid)
{
    super(manager, sound, uuid);
    this.x = this.y = this.z = 0;
    this.manager = null;
    this.name = sound.getPositionedSoundLocation().getResourcePath();
}
项目:Cauldron    文件:ForgeHooksClient.java   
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;
}