本文整理汇总了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");
}
}
}
}
示例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();
}
}
示例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);
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}