Jump to content

1.6.4 Help, Trying to add a sound file to an item


Darkly_SteamGear

Recommended Posts

so anyways, I've been trying to mod minecraft so that every time you break a block, or hit an entity, it makes a sound when using this item i've been trying to code in. i tried onLeftClick, and no sound,  i even tried using a vanilla sound to see if the code was working properly, and it didn't even work.  I cant seem to get this sound to play. and also i tried adding the files to the .json configuration file and it seems to be of no help to me. also the sound files are in the \src\main\java\assets\modname\sounds folder. i could really use some help, as youtube and the rest of the internet tutorials have failed me. i am modding 1.6.4 on the gradle setup in forge 9.11.1.964 (as for most of the good mods are back in that update, and i want to be able to use it along with a few other 1.6.4 never updated mods. 1.6.4 was a good era for mods, what can i say?) anyone here got something useful that i could possibly use or some good advice, please comment.

Link to comment
Share on other sites

Yes, we do not support 1.6.4 and older anymore. So update.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

In 1.6.4, sounds are not added via JSON, they are registered during an event:

@ForgeSubscribe
public void onLoadSound(SoundLoadEvent event) {
event.manager.addSound(ModInfo.ID + ":sound_file.ogg");
}

If you have a sound with variants (e.g. 'sound1', 'sound2', etc.), you need to register each variant separately (loops work great) BUT when you play the sound, you play it without a number (e.g. 'sound') and it chooses a random one from the variants.

 

Other than that, sounds are handled exactly the same: world.playSoundAt(Entity...) plays a sound on the server which everyone will hear, player.playSound can be used on the client side to play a sound just for that player, and packets are your go between when needed.

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.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.