From fe39bd01891e1825ac77ae0f8b36528ac15b0adc Mon Sep 17 00:00:00 2001 From: Adubbz Date: Sat, 6 Jul 2013 15:18:35 +1000 Subject: [PATCH] And fixed the record path thanks to Lex, turns out i'm a fucking retard --- .../records/bopdisc.ogg | Bin .../records/bopdiscmud.ogg | Bin .../biomesoplenty/handlers/SoundHandler.java | 23 +++++++++++++++--- 3 files changed, 19 insertions(+), 4 deletions(-) rename src/minecraft/assets/{minecraft => biomesoplenty}/records/bopdisc.ogg (100%) rename src/minecraft/assets/{minecraft => biomesoplenty}/records/bopdiscmud.ogg (100%) diff --git a/src/minecraft/assets/minecraft/records/bopdisc.ogg b/src/minecraft/assets/biomesoplenty/records/bopdisc.ogg similarity index 100% rename from src/minecraft/assets/minecraft/records/bopdisc.ogg rename to src/minecraft/assets/biomesoplenty/records/bopdisc.ogg diff --git a/src/minecraft/assets/minecraft/records/bopdiscmud.ogg b/src/minecraft/assets/biomesoplenty/records/bopdiscmud.ogg similarity index 100% rename from src/minecraft/assets/minecraft/records/bopdiscmud.ogg rename to src/minecraft/assets/biomesoplenty/records/bopdiscmud.ogg diff --git a/src/minecraft/biomesoplenty/handlers/SoundHandler.java b/src/minecraft/biomesoplenty/handlers/SoundHandler.java index 804c9a417..407990aab 100644 --- a/src/minecraft/biomesoplenty/handlers/SoundHandler.java +++ b/src/minecraft/biomesoplenty/handlers/SoundHandler.java @@ -2,16 +2,17 @@ package biomesoplenty.handlers; import java.util.logging.Level; -import net.minecraft.client.resources.ResourceLocation; +import net.minecraftforge.client.event.sound.PlayStreamingEvent; import net.minecraftforge.client.event.sound.SoundLoadEvent; import net.minecraftforge.event.ForgeSubscribe; +import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class SoundHandler { - static ResourceLocation[] recordSoundFiles = { new ResourceLocation("bopdisc.ogg"), new ResourceLocation("bopdiscmud.ogg") }; + static String[] recordSoundFiles = { "biomesoplenty:bopdisc.ogg", "biomesoplenty:bopdiscmud.ogg" }; static String[] soundFiles = { }; @SideOnly(Side.CLIENT) @@ -31,11 +32,11 @@ public class SoundHandler } } - for (ResourceLocation recordSoundFile : recordSoundFiles) + for (String recordSoundFile : recordSoundFiles) { try { - event.manager.soundPoolStreaming.addSound(recordSoundFile.func_110623_a()); + event.manager.soundPoolStreaming.addSound(recordSoundFile); } catch (Exception e) @@ -44,4 +45,18 @@ public class SoundHandler } } } + + @SideOnly(Side.CLIENT) + @ForgeSubscribe + public void onPlayStreaming(PlayStreamingEvent event) + { + if (event.name == "bopdisc") + { + FMLClientHandler.instance().getClient().sndManager.playStreaming("biomesoplenty:bopdisc", (float) event.x + 0.5F, (float) event.y + 0.5F, (float) event.z + 0.5F); + } + else if (event.name == "bopdiscmud") + { + FMLClientHandler.instance().getClient().sndManager.playStreaming("biomesoplenty:bopdiscmud", (float) event.x + 0.5F, (float) event.y + 0.5F, (float) event.z + 0.5F); + } + } }