From df96c19eb1e383c11f38f0a5aa34816d75dcc47b Mon Sep 17 00:00:00 2001 From: PeytonPlayz595 <106421860+PeytonPlayz595@users.noreply.github.com> Date: Fri, 6 Oct 2023 20:38:24 -0400 Subject: [PATCH] Unsupported sound code --- .../java/net/minecraft/src/GameSettings.java | 4 +- .../java/net/minecraft/src/GuiScreen.java | 2 +- .../java/net/minecraft/src/Minecraft.java | 14 +- .../net/minecraft/src/PlayerController.java | 2 +- .../net/minecraft/src/PlayerControllerSP.java | 2 +- .../java/net/minecraft/src/RenderGlobal.java | 2 +- .../java/net/minecraft/src/SoundManager.java | 138 ------------------ .../java/net/minecraft/src/SoundPool.java | 42 ------ .../net/minecraft/src/SoundPoolEntry.java | 13 -- 9 files changed, 13 insertions(+), 206 deletions(-) delete mode 100644 src/main/java/net/minecraft/src/SoundManager.java delete mode 100644 src/main/java/net/minecraft/src/SoundPool.java delete mode 100644 src/main/java/net/minecraft/src/SoundPoolEntry.java diff --git a/src/main/java/net/minecraft/src/GameSettings.java b/src/main/java/net/minecraft/src/GameSettings.java index 1edbb0b..e0ba7f0 100644 --- a/src/main/java/net/minecraft/src/GameSettings.java +++ b/src/main/java/net/minecraft/src/GameSettings.java @@ -55,12 +55,12 @@ public class GameSettings { public void setOptionFloatValue(int var1, int var2) { if(var1 == 0) { this.music = !this.music; - this.mc.sndManager.onSoundOptionsChanged(); + //this.mc.sndManager.onSoundOptionsChanged(); } if(var1 == 1) { this.sound = !this.sound; - this.mc.sndManager.onSoundOptionsChanged(); + //this.mc.sndManager.onSoundOptionsChanged(); } if(var1 == 2) { diff --git a/src/main/java/net/minecraft/src/GuiScreen.java b/src/main/java/net/minecraft/src/GuiScreen.java index c5c420e..252cb3f 100644 --- a/src/main/java/net/minecraft/src/GuiScreen.java +++ b/src/main/java/net/minecraft/src/GuiScreen.java @@ -35,7 +35,7 @@ public class GuiScreen extends Gui { for(int var4 = 0; var4 < this.controlList.size(); ++var4) { GuiButton var5 = (GuiButton)this.controlList.get(var4); if(var5.mousePressed(var1, var2)) { - this.mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F); + //this.mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F); this.actionPerformed(var5); } } diff --git a/src/main/java/net/minecraft/src/Minecraft.java b/src/main/java/net/minecraft/src/Minecraft.java index f61aa20..60b1b0c 100644 --- a/src/main/java/net/minecraft/src/Minecraft.java +++ b/src/main/java/net/minecraft/src/Minecraft.java @@ -39,7 +39,7 @@ public class Minecraft implements Runnable { public ModelBiped playerModelBiped = new ModelBiped(0.0F); public MovingObjectPosition objectMouseOver = null; public GameSettings gameSettings; - public SoundManager sndManager = new SoundManager(); + //public SoundManager sndManager = new SoundManager(); public MouseHelper mouseHelper; public File mcDataDir; public static long[] tickTimes = new long[512]; @@ -89,7 +89,7 @@ public class Minecraft implements Runnable { GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); this.checkGLError("Startup"); - this.sndManager.loadSoundSettings(this.gameSettings); + //this.sndManager.loadSoundSettings(this.gameSettings); this.renderEngine.registerTextureFX(this.textureLavaFX); this.renderEngine.registerTextureFX(this.textureWaterFX); this.renderEngine.registerTextureFX(new TextureWaterFlowFX()); @@ -239,7 +239,7 @@ public class Minecraft implements Runnable { System.out.println("Stopping!"); this.changeWorld1((World)null); GLAllocation.deleteTexturesAndDisplayLists(); - this.sndManager.closeMinecraft(); + //this.sndManager.closeMinecraft(); System.gc(); } @@ -281,7 +281,7 @@ public class Minecraft implements Runnable { this.timer.renderPartialTicks = 1.0F; } - this.sndManager.setListener(this.thePlayer, this.timer.renderPartialTicks); + //this.sndManager.setListener(this.thePlayer, this.timer.renderPartialTicks); GL11.glEnable(GL11.GL_TEXTURE_2D); if(this.theWorld != null) { while(this.theWorld.updatingLighting()) { @@ -832,11 +832,11 @@ public class Minecraft implements Runnable { String var4 = var1.substring(0, var3); var1 = var1.substring(var3 + 1); if(var4.equalsIgnoreCase("sound")) { - this.sndManager.addSound(var1, var2); + //this.sndManager.addSound(var1, var2); } else if(var4.equalsIgnoreCase("newsound")) { - this.sndManager.addSound(var1, var2); + //this.sndManager.addSound(var1, var2); } else if(var4.equalsIgnoreCase("music")) { - this.sndManager.addMusic(var1, var2); + //this.sndManager.addMusic(var1, var2); } } diff --git a/src/main/java/net/minecraft/src/PlayerController.java b/src/main/java/net/minecraft/src/PlayerController.java index 4abc7dc..89da0df 100644 --- a/src/main/java/net/minecraft/src/PlayerController.java +++ b/src/main/java/net/minecraft/src/PlayerController.java @@ -25,7 +25,7 @@ public class PlayerController { int var6 = var4.getBlockMetadata(var1, var2, var3); boolean var7 = var4.setBlockWithNotify(var1, var2, var3, 0); if(var5 != null && var7) { - this.mc.sndManager.playSound(var5.stepSound.getBreakSound(), (float)var1 + 0.5F, (float)var2 + 0.5F, (float)var3 + 0.5F, (var5.stepSound.getVolume() + 1.0F) / 2.0F, var5.stepSound.getPitch() * 0.8F); + //this.mc.sndManager.playSound(var5.stepSound.getBreakSound(), (float)var1 + 0.5F, (float)var2 + 0.5F, (float)var3 + 0.5F, (var5.stepSound.getVolume() + 1.0F) / 2.0F, var5.stepSound.getPitch() * 0.8F); var5.onBlockDestroyedByPlayer(var4, var1, var2, var3, var6); } diff --git a/src/main/java/net/minecraft/src/PlayerControllerSP.java b/src/main/java/net/minecraft/src/PlayerControllerSP.java index 845c644..dea3522 100644 --- a/src/main/java/net/minecraft/src/PlayerControllerSP.java +++ b/src/main/java/net/minecraft/src/PlayerControllerSP.java @@ -73,7 +73,7 @@ public class PlayerControllerSP extends PlayerController { Block var6 = Block.blocksList[var5]; this.curBlockDamage += var6.blockStrength(this.mc.thePlayer); if(this.blockDestroySoundCounter % 4.0F == 0.0F && var6 != null) { - this.mc.sndManager.playSound(var6.stepSound.getStepSound(), (float)var1 + 0.5F, (float)var2 + 0.5F, (float)var3 + 0.5F, (var6.stepSound.getVolume() + 1.0F) / 8.0F, var6.stepSound.getPitch() * 0.5F); + //this.mc.sndManager.playSound(var6.stepSound.getStepSound(), (float)var1 + 0.5F, (float)var2 + 0.5F, (float)var3 + 0.5F, (var6.stepSound.getVolume() + 1.0F) / 8.0F, var6.stepSound.getPitch() * 0.5F); } ++this.blockDestroySoundCounter; diff --git a/src/main/java/net/minecraft/src/RenderGlobal.java b/src/main/java/net/minecraft/src/RenderGlobal.java index ae05d48..7153b64 100644 --- a/src/main/java/net/minecraft/src/RenderGlobal.java +++ b/src/main/java/net/minecraft/src/RenderGlobal.java @@ -1023,7 +1023,7 @@ public class RenderGlobal implements IWorldAccess { } public void playSound(String var1, double var2, double var4, double var6, float var8, float var9) { - this.mc.sndManager.playSound(var1, (float)var2, (float)var4, (float)var6, var8, var9); + //this.mc.sndManager.playSound(var1, (float)var2, (float)var4, (float)var6, var8, var9); } public void spawnParticle(String var1, double var2, double var4, double var6, double var8, double var10, double var12) { diff --git a/src/main/java/net/minecraft/src/SoundManager.java b/src/main/java/net/minecraft/src/SoundManager.java deleted file mode 100644 index 17d5492..0000000 --- a/src/main/java/net/minecraft/src/SoundManager.java +++ /dev/null @@ -1,138 +0,0 @@ -package net.minecraft.src; - -import java.io.File; -import paulscode.sound.SoundSystem; -import paulscode.sound.SoundSystemConfig; -import paulscode.sound.codecs.CodecJOrbis; -import paulscode.sound.codecs.CodecWav; -import paulscode.sound.libraries.LibraryLWJGLOpenAL; - -public class SoundManager { - private SoundSystem sndSystem; - private SoundPool soundPoolSounds = new SoundPool(); - private SoundPool soundPoolMusic = new SoundPool(); - private int latestSoundID = 0; - private GameSettings options; - private boolean loaded = false; - - public void loadSoundSettings(GameSettings var1) { - this.options = var1; - if(!this.loaded && (var1.sound || var1.music)) { - this.tryToSetLibraryAndCodecs(); - } - - } - - private void tryToSetLibraryAndCodecs() { - try { - boolean var1 = this.options.sound; - boolean var2 = this.options.music; - this.options.sound = false; - this.options.music = false; - this.options.saveOptions(); - SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class); - SoundSystemConfig.setCodec("ogg", CodecJOrbis.class); - SoundSystemConfig.setCodec("wav", CodecWav.class); - this.sndSystem = new SoundSystem(); - this.options.sound = var1; - this.options.music = var2; - this.options.saveOptions(); - } catch (Throwable var3) { - System.err.println("error linking with the LibraryJavaSound plug-in"); - } - - this.loaded = true; - } - - public void onSoundOptionsChanged() { - if(!this.loaded && (this.options.sound || this.options.music)) { - this.tryToSetLibraryAndCodecs(); - } - - if(!this.options.music) { - this.sndSystem.stop("BgMusic"); - } - - } - - public void closeMinecraft() { - if(this.loaded) { - this.sndSystem.cleanup(); - } - - } - - public void addSound(String var1, File var2) { - this.soundPoolSounds.addSound(var1, var2); - } - - public void addMusic(String var1, File var2) { - this.soundPoolMusic.addSound(var1, var2); - } - - public void setListener(EntityLiving var1, float var2) { - if(this.loaded && this.options.sound) { - if(var1 != null) { - float var3 = var1.prevRotationPitch + (var1.rotationPitch - var1.prevRotationPitch) * var2; - float var4 = var1.prevRotationYaw + (var1.rotationYaw - var1.prevRotationYaw) * var2; - double var5 = var1.prevPosX + (var1.posX - var1.prevPosX) * (double)var2; - double var7 = var1.prevPosY + (var1.posY - var1.prevPosY) * (double)var2; - double var9 = var1.prevPosZ + (var1.posZ - var1.prevPosZ) * (double)var2; - float var11 = MathHelper.cos(-var4 * ((float)Math.PI / 180.0F) - (float)Math.PI); - float var12 = MathHelper.sin(-var4 * ((float)Math.PI / 180.0F) - (float)Math.PI); - float var13 = MathHelper.cos(-var3 * ((float)Math.PI / 180.0F)); - float var14 = MathHelper.sin(-var3 * ((float)Math.PI / 180.0F)); - float var15 = -var12 * var13; - float var17 = -var11 * var13; - float var18 = -var12 * var14; - float var20 = -var11 * var14; - this.sndSystem.setListenerPosition((float)var5, (float)var7, (float)var9); - this.sndSystem.setListenerOrientation(var15, var14, var17, var18, var13, var20); - } - } - } - - public void playSound(String var1, float var2, float var3, float var4, float var5, float var6) { - if(this.loaded && this.options.sound) { - SoundPoolEntry var7 = this.soundPoolSounds.getRandomSoundFromSoundPool(var1); - if(var7 != null && var5 > 0.0F) { - this.latestSoundID = (this.latestSoundID + 1) % 256; - String var8 = "sound_" + this.latestSoundID; - float var9 = 16.0F; - if(var5 > 1.0F) { - var9 *= var5; - } - - this.sndSystem.newSource(var5 > 1.0F, var8, var7.soundUrl, var7.soundName, false, var2, var3, var4, 2, var9); - this.sndSystem.setPitch(var8, var6); - if(var5 > 1.0F) { - var5 = 1.0F; - } - - this.sndSystem.setVolume(var8, var5); - this.sndSystem.play(var8); - } - - } - } - - public void playSoundFX(String var1, float var2, float var3) { - if(this.loaded && this.options.sound) { - SoundPoolEntry var4 = this.soundPoolSounds.getRandomSoundFromSoundPool(var1); - if(var4 != null) { - this.latestSoundID = (this.latestSoundID + 1) % 256; - String var5 = "sound_" + this.latestSoundID; - this.sndSystem.newSource(false, var5, var4.soundUrl, var4.soundName, false, 0.0F, 0.0F, 0.0F, 0, 0.0F); - if(var2 > 1.0F) { - var2 = 1.0F; - } - - var2 *= 0.25F; - this.sndSystem.setPitch(var5, var3); - this.sndSystem.setVolume(var5, var2); - this.sndSystem.play(var5); - } - - } - } -} diff --git a/src/main/java/net/minecraft/src/SoundPool.java b/src/main/java/net/minecraft/src/SoundPool.java deleted file mode 100644 index ab70ae6..0000000 --- a/src/main/java/net/minecraft/src/SoundPool.java +++ /dev/null @@ -1,42 +0,0 @@ -package net.minecraft.src; - -import java.io.File; -import java.net.MalformedURLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - -public class SoundPool { - private Random rand = new Random(); - private Map nameToSoundPoolEntriesMapping = new HashMap(); - public int numberOfSoundPoolEntries = 0; - - public SoundPoolEntry addSound(String var1, File var2) { - try { - String var3 = var1; - - for(var1 = var1.substring(0, var1.indexOf(".")); Character.isDigit(var1.charAt(var1.length() - 1)); var1 = var1.substring(0, var1.length() - 1)) { - } - - var1 = var1.replaceAll("/", "."); - if(!this.nameToSoundPoolEntriesMapping.containsKey(var1)) { - this.nameToSoundPoolEntriesMapping.put(var1, new ArrayList()); - } - - SoundPoolEntry var4 = new SoundPoolEntry(var3, var2.toURI().toURL()); - ((List)this.nameToSoundPoolEntriesMapping.get(var1)).add(var4); - ++this.numberOfSoundPoolEntries; - return var4; - } catch (MalformedURLException var5) { - var5.printStackTrace(); - throw new RuntimeException(var5); - } - } - - public SoundPoolEntry getRandomSoundFromSoundPool(String var1) { - List var2 = (List)this.nameToSoundPoolEntriesMapping.get(var1); - return var2 == null ? null : (SoundPoolEntry)var2.get(this.rand.nextInt(var2.size())); - } -} diff --git a/src/main/java/net/minecraft/src/SoundPoolEntry.java b/src/main/java/net/minecraft/src/SoundPoolEntry.java deleted file mode 100644 index 341e9ba..0000000 --- a/src/main/java/net/minecraft/src/SoundPoolEntry.java +++ /dev/null @@ -1,13 +0,0 @@ -package net.minecraft.src; - -import java.net.URL; - -public class SoundPoolEntry { - public String soundName; - public URL soundUrl; - - public SoundPoolEntry(String var1, URL var2) { - this.soundName = var1; - this.soundUrl = var2; - } -}