Posted August 18, 201213 yr so whats the new way to add sounds ? do i need audio mod or did the registerSoundHandler get moved to some where else ?
August 19, 201213 yr Check out the sound events. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
August 19, 201213 yr Author so u mean like SoundLoadEvent s = new SoundLoadEvent(new SoundHandler()); SoundHandler.java package etopsirhc.mods.tremmorCraft; import java.io.File; import net.minecraft.src.SoundManager; public class SoundHandler extends SoundManager { public SoundHandler(){ super.soundPoolSounds.addSound("gun.click",new File("/etopsirhc/mods/tremmorCraft/gun/click.ogg")); } } i seriously have no clue as how to load my own sounds , i've tried everything i could think of including using this in the client proxy FMLClientHandler.instance().getClient().sndManager.addSound("gun.click", new File("/path/file.ogg"))
August 19, 201213 yr wow.. just fucking wow... http://www.minecraftforum.net/topic/1419836-131-forge-4x-events-howto/ I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
August 19, 201213 yr Author hey , cut me a little slack , i'm relatively new to modding and b4 forge 4 came out i'd never used it XP but that said i think i got most of it right now , i just cant get it working right. in my preinit method i register the event handler class and have a soundLoadEvent handler setup , but even after setting it all up i get nothing. i've tried both ogg and wav formats . and while the playSoundAtEntity event is called for the right sound name , the sound fails to play.
August 19, 201213 yr I'll show you how I did it. In your common and client proxy (I'm assuing you have these. If you don't, read this tutorial) add a method for registering sounds, I called mine registerSounds. Inside registerSounds in your client proxy, put this: MinecraftForge.EVENT_BUS.register(new ClientEvents()); replace ClientEvents with the class you're about to set up with your sound register stuff. Make your new ClientEvents class inside the client. Put this in it: package etopsirhc.mods.tremmorCraft; import net.minecraftforge.client.event.sound.*; import net.minecraftforge.event.ForgeSubscribe; import net.minecraft.src.*; public class ClientEvents { @ForgeSubscribe public void onSoundsLoaded(SoundLoadEvent event) { SoundManager manager = event.manager; String [] soundFiles = { "gun/click.ogg"} for (int i = 0; i < soundFiles.length; i++){ manager.soundPoolSounds.addSound(soundFiles[i], this.getClass().getResource("/etopsirhc/mods/tremmorCraft/" + soundFiles[i])); } } } finally, add proxy.registerSounds(); to your pre initialization method in your mod class, and that should be it. I only just found out how to do this, so I thought I'd share it with you. If you ever want to add more sounds, just add them to the list. I'm probably doing this in a really inefficient way, but I'm a noob, so cut me some slack
August 19, 201213 yr Author YES!!!! TY !! =D after i got it working i changed it slightly from what you did i registered the event listner class in the preinit and set the @client side only on the sound load event so that i can register any event in there but only use the sounds on the client side pretty much same as what you have , but i can skip adding a second event listner for the server side by doing so
August 20, 201213 yr For some reason I didn't need to register my sounds, the only thing I noticed is, that world.playSoundEffect() do not work, but world.playSound() works fine so far. And I just have put my sound into the ressource/mod folder (like audiomod). My mods: TF2 Teleporter + Sentry + Dispenser Familiars API SpecialArmor & PrinterBlock
August 20, 201213 yr Thats because we have a audiomod compatibility layer, and if you put your things inside the resources folder, you're doing it wrong and creating nothing but useless hassle for your end user. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
August 20, 201213 yr Thats because we have a audiomod compatibility layer, and if you put your things inside the resources folder, you're doing it wrong and creating nothing but useless hassle for your end user. So when I'm using the soundmanager, I can just put my soundfiles into my mod.zip? Awesome My mods: TF2 Teleporter + Sentry + Dispenser Familiars API SpecialArmor & PrinterBlock
August 20, 201213 yr Yes, thats one of the main points, EVERY mod should be a SINGLE jar and the end user should ONLY have to put it in the mods folder. If you have install instructions that are more complicated then that, you're doing it wrong. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
August 20, 201213 yr Yes, thats one of the main points, EVERY mod should be a SINGLE jar and the end user should ONLY have to put it in the mods folder. If you have install instructions that are more complicated then that, you're doing it wrong. Unless your mod is like NEI. So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.
August 20, 201213 yr Yes, thats one of the main points, EVERY mod should be a SINGLE jar and the end user should ONLY have to put it in the mods folder. If you have install instructions that are more complicated then that, you're doing it wrong. Unless your mod is like NEI. Nope, even then, NEI technically doesn't need to be in the jar, It can use any of the methods that FML/Forge provides to do what it wants. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.