EnderTurret / PatchedMod

A Minecraft mod that adds the ability to patch Json files for resource and data packs.
GNU Lesser General Public License v2.1
2 stars 0 forks source link

[Question] Resource Pack not Detected #17

Open vertexcubed opened 1 month ago

vertexcubed commented 1 month ago

Trying to write a simple resourcepack to patch vanilla's sounds.json to change some stuff, but patched isn't even detecting my pack? The resource pack is loaded in the vanilla resourcepacks folder if that helps

My pack.mcmeta:

{
    "pack": {
        "pack_format": 15,
        "description": "Replaces some of the combat sounds. Requires Patched."
    },
    "patched": {
        "format_version": 1
    }
}

My patch file, assets/minecraft/sounds.json.patch:

[
    {
        "op": "replace",
        "path": "/entity.player.attack.crit/sounds",
        "value": [
            {
                "name": "combat_sounds:crit",
                "volume": 0.7
            }
        ]
    },
    {
        "op": "replace",
        "path": "/entity.player.attack.strong/sounds",
        "value": [
            {
                "name": "combat_sounds:slash",
                "volume": 0.7
            }
        ]
    }
]
EnderTurret commented 1 month ago

You're running into a technical limitation of Patched here. The sounds.json file is one of a handful of files that Minecraft merges between all packs (like languages and tags), and Patched can't currently patch those. This is because since Minecraft looks at each pack's copy of the file individually (foregoing the resource manager), it'd be difficult for Patched to figure out which copy should be patched (while also maintaining pack ordering et al.)

However, I believe in this case you can achieve the same goal without needing Patched. Since the sounds.jsons are merged, you should be able to redefine entity.player.attack.crit and entity.player.attack.strong by copying their definitions to your resource pack's sounds.json (and replacing the sound paths, of course). Alternatively, if the original sounds are only used for these and the volume doesn't need to be changed, you could just replace the sound files themselves.