Jump to content

[1.12] Replacing one vanilla sound wipes out others


DarkMorford

Recommended Posts

I have the following sounds.json file in my mod's src/main/resources/assets/minecraft directory:

{
	"entity.endermen.stare": {
		"replace": true,
		"sounds": ["btweagles:beejdrop"]
	},
	"entity.endermen.scream": {
		"replace": true,
		"sounds": ["btweagles:beejdrop"]
	}
}

 

As I understand it, every mod is also a resource pack, and according to the official wiki, "unlike most other files in resource packs, sounds.json will merge sound information from packs below the top pack, rather than each sounds.json file overriding the previous completely." Given that, I would expect that only the two SoundEvents I have listed would be replaced, and all other vanilla sounds would be unaffected.

However, this does not appear to be the case. Instead, I'm met with a litany of warnings when Minecraft starts up:

[main/WARN]: Missing sound for event: minecraft:ambient.cave
[main/WARN]: Missing sound for event: minecraft:block.anvil.break
[main/WARN]: Missing sound for event: minecraft:block.anvil.destroy
[main/WARN]: Missing sound for event: minecraft:block.anvil.fall
[main/WARN]: Missing sound for event: minecraft:block.anvil.hit
[main/WARN]: Missing sound for event: minecraft:block.anvil.land
[main/WARN]: Missing sound for event: minecraft:block.anvil.place
[main/WARN]: Missing sound for event: minecraft:block.anvil.step
...

And indeed no sounds play except for those I've explicitly defined in my sounds.json file.

Does this mean I have to replicate the entire vanilla sounds.json in order to replace just a few sound files, or is there a more modder-friendly way to do it?

Link to comment
Share on other sites

Vanilla is already supplying a sounds.json at that location.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

SoundHandler#onResourceManagerReload explicitly iterates through every copy of sounds.json for each domain (using IResourceManager#getAllResources), it doesn't just use first one it finds (using IResourceManager#getResource) like most other places in the code do.

 

Looking at the code, it should only replace the sounds present in each sounds.json file (that opt-in to replace existing sounds); I'm not sure why the other sounds are being removed.

 

Try setting a breakpoint in SoundHandler#onResourceManagerReload and stepping through the code.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Hm, interesting. Assuming I'm understanding this correctly, it appears that DefaultResourcePack#getResourceStream is somehow finding a copy of my sounds.json file (located at file:/H:/projects/BetterThanWeagles/out/production/BetterThanWeagles_main/assets/minecraft/sounds.json) instead of the vanilla one. This is causing my sounds.json to get loaded twice (redundantly) and the vanilla sounds to not load at all.

Edited by DarkMorford
Link to comment
Share on other sites

I guess it shouldn't be in minecraft domain. It should under the domain for your own mod, i.e. assets/(modid)/sounds.json.

Because the assets folder is to be merged.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

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.