Jump to content

Recommended Posts

Posted

I'm looking for some help to get this added as a proper PR to forge. I have a working class for adding the sound category that will work in a mod. I've tested this with with 1.9.4 and 1.10+. I have not yet tried to setup a Forge dev environment but the videos that cpw made make it look simple enough. I still pretty much a java rookies, but learning more as I go. Your comments are welcome.

 

The class below allows the addition of a new sound category. It uses nothing more that the existing Forge utility classes for reflections and enums. You new sound category will have all the attributes of the vanilla sound categories.

That is:

  • A volume control for the category displays in the vanilla "Music & Sound Options..." dialog
  • The volume level is saved and loaded from the client options.txt file.
  • The Vanilla SoundHandler will correctly use the custom sound category

Here's the class on GitHub. There are some notes about using it in the comments

MODSoundCategory

I've also included the code below.

 

I have not started work to see what's required to make the vanilla "Music & Sound Options..." dialog behave correctly. Ideally it would work like the "Controls..." dialog. That is the volume controls could be scrolled. So far I've not seen anyone other mod add a custom SoundCategory / volume control. But it might be useful for other mods. And as a part of Forge mod authors could use it without fear of causing issues with vanilla or other mods.

 

For the mxTune mod I'm working on I wanted a separate sound category for the instruments. I can get by without this PR, but I wanted to share this with the community.

 

MODSoundCategory.class

 

  Reveal hidden contents

 

From this point on I'll just use bare bones minimal/incomplete code...

Creating custom sound categories:

 

  Reveal hidden contents

 

Here's one way to use the custom sound category

 

  Reveal hidden contents

 

If you add or change  or remove your custom sound categories in your mod, vanilla will gracefully ignore and overwrite the settings. No worries about a crash for a missing custom sound category.

 

If you goof up and add a conflicting sound category you will crash MC. Oops!, but of course as a developer you should know better right!

Section of the client side options.txt where game settings are saved.

 

  Reveal hidden contents

 

 

Here's a demo of it in use:

[embed=425,349]<iframe width="560" height="315" src="https://www.youtube.com/embed/A5lhR-pP4Mg" frameborder="0" allowfullscreen></iframe>[/embed]

 

Here's how the current 1.10.2 vanilla "Music & Sounds Options.." looks after adding several more unique sound categories. Yup, the dialog needs some loving.

 

  Reveal hidden contents

 

 

  Reveal hidden contents

 

 

  Reveal hidden contents

 

  • 1 month later...
Posted

This is a very good feature. I would definitely use it if I update my Mod to 1.11 and it's there. (I would use it in 1.7.10 too, but I don't think the forge team is willing to add stuff to 1.7 :'().

 

One thing that I think needs to get added is a submenu. So you have a button "Mod Sound Sliders" which opens a submenu with a list of all modded sound sliders. (Similar to keybindings). Every mod is a major category, and maybe allow mods to add a minor category within the mod.

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.