Jump to content

Recommended Posts

Posted

I'm trying to add sounds for a gun in a mod I'm working on with a friend(a mod based on the Carnivores series of games, i.e. Carnivores, Carnivores: Ice Age) and I'm not sure on the most recent methods used for this.

 

The tutorial for a blaster on the Forge wiki used this:

@ForgeSubscribe
   public void onSound(SoundLoadEvent event)
   {
       try
       {
       		String [] soundFiles = {
       				"lasershot.ogg",
       				"miningshot.wav",
       				"miningcharge.wav",
       				"miningLoaded1.wav",
       				"plasmaboil1.wav",
       				"plasmaboil2.wav",
       				"plasmaCharged.wav",
       				"plasmashot2.wav",
       				"plasmablast1.wav",
       				"blastershot1.wav",
       				"blastershot2.wav"
       				};
       		for (int i = 0; i < soundFiles.length; i++){
       			event.manager.soundPoolSounds.addSound(soundFiles[i], SenitielsSpaceMarineMod.class.getResource("/mods/SenitielsSpaceMarineMod/sounds/" + soundFiles[i]));
       		}
      
       }
       catch (Exception e)
       {
           System.err.println("Space Marine Mod: Failed to register one or more sounds.");
       }
   }

 

However, I have no idea what this would look like with 1.7.10 methods.

Posted

In 1.7, you no longer use any events at all, but a json file for sounds. Put it in your resources/assets directory (the base directory, not the sounds folder).

 

It should look something like this:

{
    "levelup": {"category": "player","sounds":["special/levelup"]},
    "master_sword": {"category": "ambient","sounds":["special/master_sword"]},
    "secret_medley": {"category": "ambient","sounds":["special/secret_medley"]}
}

Note that the final entry does not have a comma. The directory for those sounds is "assets/sounds/sound | subfolder"

 

EDIT: Btw, I have only used .ogg format in 1.7; I'm not sure if .wav works or not, so you'll have to try it.

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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