mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-16 10:34:49 +00:00
Finally do SoundSystem workup for 1.7, Closes #982
This commit is contained in:
1 parent
5fbc70173c
commit
621fb050ce
16 files changed
+150
-22
No files matched your search
@@ -72,7 +72,7 @@
|
||||
if (p_147108_1_ instanceof GuiMainMenu)
|
||||
{
|
||||
this.field_71474_y.field_74330_P = false;
|
||||
@@ -1297,7 +1311,7 @@
|
||||
@@ -1296,7 +1310,7 @@
|
||||
|
||||
if (this.field_71439_g.func_82246_f(i, j, k))
|
||||
{
|
||||
@@ -81,7 +81,7 @@
|
||||
this.field_71439_g.func_71038_i();
|
||||
}
|
||||
}
|
||||
@@ -1378,11 +1392,12 @@
|
||||
@@ -1377,11 +1391,12 @@
|
||||
int j = this.field_71476_x.field_72312_c;
|
||||
int k = this.field_71476_x.field_72309_d;
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
{
|
||||
flag = false;
|
||||
this.field_71439_g.func_71038_i();
|
||||
@@ -1409,7 +1424,8 @@
|
||||
@@ -1408,7 +1423,8 @@
|
||||
{
|
||||
ItemStack itemstack1 = this.field_71439_g.field_71071_by.func_70448_g();
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
{
|
||||
this.field_71460_t.field_78516_c.func_78445_c();
|
||||
}
|
||||
@@ -1608,6 +1624,8 @@
|
||||
@@ -1607,6 +1623,8 @@
|
||||
|
||||
while (Mouse.next())
|
||||
{
|
||||
@@ -115,7 +115,7 @@
|
||||
i = Mouse.getEventButton();
|
||||
|
||||
if (field_142025_a && i == 0 && (Keyboard.isKeyDown(29) || Keyboard.isKeyDown(157)))
|
||||
@@ -2075,6 +2093,11 @@
|
||||
@@ -2074,6 +2092,11 @@
|
||||
|
||||
public void func_71353_a(WorldClient p_71353_1_, String p_71353_2_)
|
||||
{
|
||||
@@ -127,7 +127,7 @@
|
||||
if (p_71353_1_ == null)
|
||||
{
|
||||
NetHandlerPlayClient nethandlerplayclient = this.func_147114_u();
|
||||
@@ -2087,6 +2110,18 @@
|
||||
@@ -2086,6 +2109,18 @@
|
||||
if (this.field_71437_Z != null)
|
||||
{
|
||||
this.field_71437_Z.func_71263_m();
|
||||
@@ -146,7 +146,7 @@
|
||||
}
|
||||
|
||||
this.field_71437_Z = null;
|
||||
@@ -2235,113 +2270,10 @@
|
||||
@@ -2234,113 +2269,10 @@
|
||||
if (this.field_71476_x != null)
|
||||
{
|
||||
boolean flag = this.field_71439_g.field_71075_bZ.field_75098_d;
|
||||
@@ -262,7 +262,7 @@
|
||||
if (flag)
|
||||
{
|
||||
j = this.field_71439_g.field_71069_bz.field_75151_b.size() - 9 + this.field_71439_g.field_71071_by.field_70461_c;
|
||||
@@ -2508,8 +2440,15 @@
|
||||
@@ -2507,8 +2439,15 @@
|
||||
p_70001_1_.func_76472_a("gl_max_texture_size", Integer.valueOf(func_71369_N()));
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@
|
||||
for (int i = 16384; i > 0; i >>= 1)
|
||||
{
|
||||
GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null);
|
||||
@@ -2517,6 +2456,7 @@
|
||||
@@ -2516,6 +2455,7 @@
|
||||
|
||||
if (j != 0)
|
||||
{
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
--- ../src-base/minecraft/net/minecraft/client/audio/SoundManager.java
|
||||
+++ ../src-work/minecraft/net/minecraft/client/audio/SoundManager.java
|
||||
@@ -35,6 +35,11 @@
|
||||
@@ -35,6 +35,10 @@
|
||||
import paulscode.sound.codecs.CodecJOrbis;
|
||||
import paulscode.sound.libraries.LibraryLWJGLOpenAL;
|
||||
|
||||
+import net.minecraftforge.client.*;
|
||||
+import net.minecraftforge.client.event.sound.*;
|
||||
+import net.minecraftforge.common.MinecraftForge;
|
||||
+import static net.minecraftforge.client.event.sound.SoundEvent.*;
|
||||
+
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class SoundManager
|
||||
{
|
||||
@@ -69,6 +74,7 @@
|
||||
@@ -69,6 +73,7 @@
|
||||
{
|
||||
SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class);
|
||||
SoundSystemConfig.setCodec("ogg", CodecJOrbis.class);
|
||||
@@ -20,7 +19,7 @@
|
||||
}
|
||||
catch (SoundSystemException soundsystemexception)
|
||||
{
|
||||
@@ -80,6 +86,7 @@
|
||||
@@ -80,6 +85,7 @@
|
||||
{
|
||||
this.func_148613_b();
|
||||
this.func_148608_i();
|
||||
@@ -28,3 +27,26 @@
|
||||
}
|
||||
|
||||
private synchronized void func_148608_i()
|
||||
@@ -302,6 +308,9 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
+ p_148611_1_ = ForgeHooksClient.playSound(this, p_148611_1_);
|
||||
+ if (p_148611_1_ == null) return;
|
||||
+
|
||||
SoundEventAccessorComposite soundeventaccessorcomposite = this.field_148622_c.func_147680_a(p_148611_1_.func_147650_b());
|
||||
|
||||
if (soundeventaccessorcomposite == null)
|
||||
@@ -343,10 +352,12 @@
|
||||
if (soundpoolentry.func_148648_d())
|
||||
{
|
||||
this.field_148620_e.newStreamingSource(false, s, func_148612_a(resourcelocation), resourcelocation.toString(), flag, p_148611_1_.func_147649_g(), p_148611_1_.func_147654_h(), p_148611_1_.func_147651_i(), p_148611_1_.func_147656_j().func_148586_a(), f1);
|
||||
+ MinecraftForge.EVENT_BUS.post(new PlayStreamingSourceEvent(this, p_148611_1_, s));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.field_148620_e.newSource(false, s, func_148612_a(resourcelocation), resourcelocation.toString(), flag, p_148611_1_.func_147649_g(), p_148611_1_.func_147654_h(), p_148611_1_.func_147651_i(), p_148611_1_.func_147656_j().func_148586_a(), f1);
|
||||
+ MinecraftForge.EVENT_BUS.post(new PlaySoundSourceEvent(this, p_148611_1_, s));
|
||||
}
|
||||
|
||||
field_148621_b.debug(field_148623_a, "Playing sound {} for event {} as channel {}", new Object[] {soundpoolentry.func_148652_a(), soundeventaccessorcomposite.func_148729_c(), s});
|
||||
@@ -5,6 +5,9 @@ import java.util.Random;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import net.minecraftforge.client.event.MouseEvent;
|
||||
import net.minecraft.client.audio.ISound;
|
||||
import net.minecraft.client.audio.SoundEventAccessorComposite;
|
||||
import net.minecraft.client.audio.SoundManager;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiMainMenu;
|
||||
@@ -48,6 +51,7 @@ import net.minecraftforge.client.event.DrawBlockHighlightEvent;
|
||||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.client.event.sound.PlaySoundEvent17;
|
||||
import net.minecraftforge.common.ForgeModContainer;
|
||||
import net.minecraftforge.common.ForgeVersion;
|
||||
import net.minecraftforge.common.ForgeVersion.Status;
|
||||
@@ -441,4 +445,12 @@ public class ForgeHooksClient
|
||||
gui.drawString(font, line, width - font.getStringWidth(line) - 2, height - (2 * (font.FONT_HEIGHT + 1)), -1);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.client.audio.SoundPoolEntry;
|
||||
* If you return null from this function it will prevent the sound from being played,
|
||||
* you can return a different entry if you want to change the sound being played.
|
||||
*/
|
||||
@Deprecated // Remove in 1.8
|
||||
public class PlayBackgroundMusicEvent extends SoundResultEvent
|
||||
{
|
||||
public PlayBackgroundMusicEvent(SoundManager manager, SoundPoolEntry entry)
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.minecraftforge.client.event.sound;
|
||||
import net.minecraft.client.audio.SoundManager;
|
||||
import net.minecraft.client.audio.SoundPoolEntry;
|
||||
|
||||
@Deprecated //Remove in 1.8
|
||||
public class PlaySoundEffectEvent extends SoundResultEvent
|
||||
{
|
||||
public PlaySoundEffectEvent(SoundManager manager, SoundPoolEntry source, String name, float volume, float pitch)
|
||||
|
||||
@@ -2,12 +2,14 @@ package net.minecraftforge.client.event.sound;
|
||||
|
||||
import net.minecraft.client.audio.SoundManager;
|
||||
|
||||
@Deprecated //Remove in 1.8
|
||||
public class PlaySoundEffectSourceEvent extends SoundEvent
|
||||
{
|
||||
public final SoundManager manager;
|
||||
public final String name;
|
||||
public PlaySoundEffectSourceEvent(SoundManager manager, String name)
|
||||
{
|
||||
super(manager);
|
||||
this.manager = manager;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ import net.minecraft.client.audio.SoundManager;
|
||||
import net.minecraft.client.audio.SoundPoolEntry;
|
||||
|
||||
/***
|
||||
* Raised when the SoundManager tries to play a normal sound,
|
||||
* dogs barking, footsteps, etc. THe majority of all sounds during normal game play.
|
||||
* Raised when the SoundManager tries to play a normal sound.
|
||||
*
|
||||
* If you return null from this function it will prevent the sound from being played,
|
||||
* you can return a different entry if you want to change the sound being played.
|
||||
*/
|
||||
@Deprecated // Switch with PlaySoundEvent17 in 1.8
|
||||
public class PlaySoundEvent extends SoundResultEvent
|
||||
{
|
||||
public final float x;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package net.minecraftforge.client.event.sound;
|
||||
|
||||
import net.minecraft.client.audio.ISound;
|
||||
import net.minecraft.client.audio.SoundCategory;
|
||||
import net.minecraft.client.audio.SoundManager;
|
||||
import net.minecraft.client.audio.SoundPoolEntry;
|
||||
|
||||
/***
|
||||
* Raised when the SoundManager tries to play a normal sound.
|
||||
*
|
||||
* If you return null from this function it will prevent the sound from being played,
|
||||
* you can return a different entry if you want to change the sound being played.
|
||||
*/
|
||||
//TODO: Replace PlaySoundEvent in 1.8
|
||||
public class PlaySoundEvent17 extends SoundEvent
|
||||
{
|
||||
public final String name;
|
||||
public final ISound sound;
|
||||
public ISound result;
|
||||
|
||||
public PlaySoundEvent17(SoundManager manager, ISound sound, SoundCategory category)
|
||||
{
|
||||
super(manager);
|
||||
this.sound = sound;
|
||||
this.name = sound.getPositionedSoundLocation().getResourcePath();
|
||||
this.result = sound;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,38 @@
|
||||
package net.minecraftforge.client.event.sound;
|
||||
|
||||
import net.minecraft.client.audio.ISound;
|
||||
import net.minecraft.client.audio.SoundManager;
|
||||
import net.minecraftforge.client.event.sound.SoundEvent.SoundSourceEvent;
|
||||
|
||||
public class PlaySoundSourceEvent extends SoundEvent
|
||||
public class PlaySoundSourceEvent extends SoundSourceEvent
|
||||
{
|
||||
@Deprecated
|
||||
public final SoundManager manager;
|
||||
@Deprecated
|
||||
public final String name;
|
||||
@Deprecated
|
||||
public final float x;
|
||||
@Deprecated
|
||||
public final float y;
|
||||
@Deprecated
|
||||
public final float z;
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import net.minecraft.client.audio.SoundPoolEntry;
|
||||
* you can return a different entry if you want to change the sound being played.
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public class PlayStreamingEvent extends SoundResultEvent
|
||||
{
|
||||
public final float x;
|
||||
|
||||
@@ -1,20 +1,38 @@
|
||||
package net.minecraftforge.client.event.sound;
|
||||
|
||||
import net.minecraft.client.audio.ISound;
|
||||
import net.minecraft.client.audio.SoundManager;
|
||||
import net.minecraftforge.client.event.sound.SoundEvent.SoundSourceEvent;
|
||||
|
||||
public class PlayStreamingSourceEvent extends SoundEvent
|
||||
public class PlayStreamingSourceEvent extends SoundSourceEvent
|
||||
{
|
||||
@Deprecated
|
||||
public final SoundManager manager;
|
||||
@Deprecated
|
||||
public final String name;
|
||||
@Deprecated
|
||||
public final float x;
|
||||
@Deprecated
|
||||
public final float y;
|
||||
@Deprecated
|
||||
public final float z;
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,38 @@
|
||||
package net.minecraftforge.client.event.sound;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.client.audio.ISound;
|
||||
import net.minecraft.client.audio.SoundManager;
|
||||
import net.minecraft.client.audio.SoundPoolEntry;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class SoundEvent extends Event
|
||||
{
|
||||
public SoundEvent(){}
|
||||
public final SoundManager manager;
|
||||
public SoundEvent(SoundManager manager)
|
||||
{
|
||||
this.manager = manager;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static SoundPoolEntry getResult(SoundResultEvent event)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event.result;
|
||||
}
|
||||
|
||||
public static class SoundSourceEvent extends SoundEvent
|
||||
{
|
||||
public final ISound sound;
|
||||
public final String uuid;
|
||||
public final String name;
|
||||
|
||||
public SoundSourceEvent(SoundManager manager, ISound sound, String uuid)
|
||||
{
|
||||
super(manager);
|
||||
this.name = sound.getPositionedSoundLocation().getResourcePath();
|
||||
this.sound = sound;
|
||||
this.uuid = uuid;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,11 @@ import net.minecraft.client.audio.SoundManager;
|
||||
*/
|
||||
public class SoundLoadEvent extends SoundEvent
|
||||
{
|
||||
@Deprecated
|
||||
public final SoundManager manager;
|
||||
public SoundLoadEvent(SoundManager manager)
|
||||
{
|
||||
super(manager);
|
||||
this.manager = manager;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package net.minecraftforge.client.event.sound;
|
||||
import net.minecraft.client.audio.SoundManager;
|
||||
import net.minecraft.client.audio.SoundPoolEntry;
|
||||
|
||||
@Deprecated //Remove in 1.8
|
||||
public abstract class SoundResultEvent extends SoundEvent
|
||||
{
|
||||
public final SoundManager manager;
|
||||
@@ -14,6 +15,7 @@ public abstract class SoundResultEvent extends SoundEvent
|
||||
|
||||
public SoundResultEvent(SoundManager manager, SoundPoolEntry source, String name, float volume, float pitch)
|
||||
{
|
||||
super(manager);
|
||||
this.manager = manager;
|
||||
this.source = source;
|
||||
this.name = name;
|
||||
|
||||
@@ -8,9 +8,11 @@ import net.minecraft.client.audio.SoundManager;
|
||||
*/
|
||||
public class SoundSetupEvent extends SoundEvent
|
||||
{
|
||||
@Deprecated
|
||||
public final SoundManager manager;
|
||||
public SoundSetupEvent(SoundManager manager)
|
||||
{
|
||||
super(manager);
|
||||
this.manager = manager;
|
||||
}
|
||||
}
|
||||
@@ -22,10 +22,7 @@ public net.minecraft.item.ItemSpade <init>(Lnet.minecraft.item.Item$ToolMaterial
|
||||
#public bfl.u #FD:RenderGlobal/field_72776_r #globalRenderBlocks
|
||||
#public bfl.H #FD:RenderGlobal/field_72738_E #damagedBlocks
|
||||
# SoundManager
|
||||
#public bln.b #FD:SoundManager/field_77381_a #sndSystem
|
||||
#public bln.d #FD:SoundManager/field_77379_b #soundPoolSounds
|
||||
#public bln.e #FD:SoundManager/field_77380_c #soundPoolStreaming
|
||||
#public bln.f #FD:SoundManager/field_77377_d #soundPoolMusic
|
||||
public net.minecraft.client.audio.SoundManager field_148622_c #sndHandler
|
||||
# EntityMinecart
|
||||
#protected st.* #FD:EntityMinecart/* # All private -> protected
|
||||
# Block
|
||||
|
||||
Reference in new issue
Block a user