stashymane / extra-sounds

Creative Commons Zero v1.0 Universal
40 stars 21 forks source link

Resource pack features aren't working #97

Open emihead opened 1 year ago

emihead commented 1 year ago

Minecraft: 1.19.2 Mod: 2.3.1

I'm trying to change this mod's custom sound events with a resource pack and I'm not getting any results. I'm not sure what I could be doing wrong. This method works fine for changing vanilla stuff and judging by the wiki it should be working here too.

image

This is just the default sounds.json from the mod file but with that specific event changed, as well as a couple others. Here's the whole file, though: sounds.json.txt

lonefelidae16 commented 1 year ago

I tried your change on my instance, and can confirm it won’t work.

[Worker-Main-6/WARN] (Minecraft) File minecraft:sounds/entity.villager.death.ogg does not exist, cannot add it to event extrasounds:chat.message

~The correct code is below in 1.19.x:~

{
  "chat.message": {
    "sounds": [
      {
        "name": "minecraft:mob/villager/death"
      }
    ],
    "replace": true
  }
}

~EDIT: I missed to set the type key in sounds values. This code works:

{
  "chat.message": {
    "sounds": [
      {
        "name": "minecraft:entity.villager.death",
        "type": "event"
      }
    ],
    "replace": true
  }
}

Please make sure your resource pack is valid, activated, and that it is set above the Fabric resources.

~End of Edit

See also: https://minecraft.fandom.com/wiki/Tutorials/Sound_directory

However, I think it’s not a very important thing because just an example; your change seems to be a simple test.

Since there is only so much that can be done with the resource pack, I will try to describe all the patterns.


Pattern 1: Change the Mod’s sound

The same as when apply to ExtraSounds as you mentioned.

assets/extrasounds/sounds.json

{
  "chat.mention": {
    "sounds": [
      {
        "name": "minecraft:random/levelup",
        "volume": 0.6
      }
    ],
    "replace": true
  }
}

When your name appears with @ in the chat, it changes to the level-up sound. If you change the namespace (this case is extrasounds), you can apply it to other mod’s sounds as well.


Pattern 2: Change the Minecraft’s sound

assets/minecraft/sounds.json

{
  "ui.button.click": {
    "sounds": [
      {
        "name": "minecraft:note/bit",
        "pitch": 2.0
      }
    ],
    "replace": true
  }
}

This changes the click sound to the bit sound used in the note block.


Pattern 3: Change to the Unique sound

Place the unique sound you want to play at assets/${namespace}/sounds/example.ogg. If you keep it in ogg format, there will be no problem.

assets/minecraft/sounds.json

{
  "ui.button.click": {
    "sounds": [
      {
        "name": "${namespace}:example"
      }
    ],
    "replace": true
  }
}

Please replace ${namespace} to your unique string. This changes the click sound to your unique sound.


I hope this helps.