Sounds

Revision as of 12:03, 7 March 2024 by Frank The Farmer (talk | contribs) (Sounds like there's a new wiki page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Preface

The sounds JSON is responsible for assigning sound files to any sound events. This file is not exclusive to Cobblemon. You can learn more about it from the Minecraft Wiki. This purpose of this page is to show you how to use it with Cobblemon.

File And Folder Format

The sounds JSON simply adds more sound events and files for Minecraft to play. It does not overwrite other sounds JSONs in other resourcepacks. Replacements for sound event data would need to be specified inside of the file. You can reference Cobblemon's sounds.json to see what sound events and sounds you can manipulate.

There may be times where writing a sounds JSON would be irrelevant. One example would be if you want to replace a sound, but not add any to the sound event. You can simply have your resourcepack formatted to replace the ogg file like you would with texture replacements. You can find the file address for specific sound files by searching in the .jar or by referencing the Gitlab folder for sounds.


Below is an example of how you would arrange a sounds.json and any custom sound files into a resourcepack:

  • Minecraft only supports ogg sound files.
  • Organization is recommended, but the correct file address is mandatory.

Folder Structure

  • (addon name)
    • pack.mcmeta
    • assets
      • cobblemon
        • sounds.json
        • sounds
          • <primary folder>
            • <sound>.ogg
            • <secondary folder> (optional for organization)
              • <sound>.ogg (optional)


Sounds JSON Breakdown

Remember that you can learn more about the sounds.json and its properties from the Minecraft Wiki. Since you can only have one sounds JSON per resourcepack, you either have to group all your sound data together, or make separate resourcepacks if necessary.


Below is a breakdown of a sounds.json performing some relevant functions. Hover over the underlined text to see more information.

{
 "poke_ball.open": {
   "replace": true,
   "subtitle": "Hahaha",
   "sounds": [
     "cobblemon:pokeball/open",
     "cobblemon:pokeball/open2",
     {
       "name": "cobblemon:pokeball/open3",
       "volume": 0.5
     }
   ]
 },
 "pokemon.charizard.cry": {
   "sounds": [ "cobblemon:pokemon/charizard/funny" ]
 }
}

If this file were loaded, it would do the following:

  • Replace the data for the poke_ball.open sound event with the data it has here
    • Add a subtitle whenever this event plays
      • If subtitles are on, "Hahaha" is what would appear during this sound event.
    • Play one of the three listed sound files whenever a Pokémon escapes the pokéball.
      • All three have an equal chance to be played since a weight property was not applied.
      • Only open3.ogg would play at half volume.
  • Add a new sound file to play for Charizard's cry animation
    • It does not replace the original sound because the replace property is not written for this sound event.
    • There would be a 50% chance of playing this funny sound whenever sending out a Charizard.


Sounds JSON Examples

This section contains a couple examples of a sounds.json for Cobblemon addons.


Below is an example of a sounds JSON that would add a sound for a custom Pokémon cry. This sound event would need to be tied to a cry animation through a sound keyframe in this specific animation. The sounds JSON creates the sound event and the animation plays the sound event. This example is not exclusive to cries. The same process would work for any sound in any animation.

{
   "pokemon.tentaquil.cry": {
       "sounds": ["cobblemon:pokemon/tentaquil/tentaquil_cry"]
   }
}


Below is an example of a sounds JSON that would replace some sound event data. Remember that you would only want to do this if you plan to add more sounds to this sound event. Otherwise, just replace the ogg. You can reference Cobblemon's sounds.json to see what sound events and sounds you can manipulate.

{
 "poke_ball.open": {
   "replace": true,
   "sounds": [
     "cobblemon:pokeball/open",
     "cobblemon:pokeball/open2",
     "cobblemon:pokeball/open3"
   ]
 }
}