Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

so whats the new way to add sounds ?

do i need audio mod or did the registerSoundHandler get moved to some where else ?

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

  • 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"))

 

  • 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.

 

 

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 :P

  • 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

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

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

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.