Jump to content

Playing sounds? Can't get it to work [solved]


McJty

Recommended Posts

Hi all, I have a sounds.json file that looks like this:

 

{
    "teleport_whoosh" : {"category": "block", "sounds": [{"name":"teleport_whoosh","stream":"false"]}
}

 

It is placed inside my assets/rftools/sounds folder.

 

In code I try to play the sound like this:

 

        worldObj.playSoundAtEntity(teleportingPlayer, RFTools.MODID+":teleport_whoosh", 1.0f, 1.0f);

 

But I get this error in the log and no sound:

 

[07:59:50] [Client thread/WARN]: Unable to play unknown soundEvent: rftools:teleport_whoosh

 

I also tried without RFTools.MODID+":" but that doesn't work either.

 

What am I missing?

 

Link to comment
Share on other sites

Hi

 

An example from one of my mods

 

resourceLocation = new ResourceLocation("speedytoolsmod:complex.boundarygrab");

 

sound file

 

resources/assets/speedytoolsmod/sounds/complex/boundarygrabquiet.ogg

 

in the json:

{

  "complex.boundarygrab": {"category": "player", "sounds": ["complex/boundarygrabquiet"]}

}

 

Your json looks a bit different to mine, perhaps try the simpler format.  The other bits look fine to me.

 

-TGG

 

PS the json file should be

resources/assets/speedytoolsmod/sounds.json

not

resources/assets/speedytoolsmod/sounds/sounds.json

 

perhaps that's the reason...

 

Link to comment
Share on other sites

Thanks! Your suggestions fixed it. I misinterpreted this tutorial (http://www.minecraftforge.net/wiki/MrGReapers_tutorials/1.7.2_sound_tutorial) when it said:

 

n your dev enviroment your resources folder will be in : root\src\main\resources\assets\modid in that modid folder you need to create a "sounds" folder and a sounds.json file

 

So I thought the sounds.json should go inside the sounds folder.

 

It works perfectly now.

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.