Jump to content

Custom sound on block click


orangelight

Recommended Posts

>:(

I tried that here is my code.

EventSounds

 

 

package orangelight.periodiccraft.common;

import net.minecraftforge.client.event.sound.SoundLoadEvent;
import net.minecraftforge.event.ForgeSubscribe;

public class Orangelight_EventSounds {
public class YourMod_EventSounds
{
    @ForgeSubscribe
    public void onSound(SoundLoadEvent event)
    {
        try 
        {
            event.manager.soundPoolSounds.addSound("flute.ogg", PeriodicCraft.class.getResource("/orangelight/periodiccraft/art/"));            
        
        } 
        catch (Exception e)
        {
            System.err.println("Failed to register one or more sounds.");
        }
    }
}
}

 

 

Put this where i want it to play my sound

 

 

world.playSoundEffect(0, 0, 0, "fluteC.ogg", 3.0F, 3.0F);

 

 

Link to comment
Share on other sites

when I start it up i get this error

2013-03-08 15:50:42 [iNFO] [sTDOUT] Starting up SoundSystem...
2013-03-08 15:50:42 [iNFO] [sTDOUT] Initializing LWJGL OpenAL
2013-03-08 15:50:42 [iNFO] [sTDOUT]     (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
2013-03-08 15:50:43 [iNFO] [sTDOUT] Error in class 'LibraryLWJGLOpenAL'
2013-03-08 15:50:43 [iNFO] [sTDOUT]     Unable to initialize OpenAL.  Probable cause: OpenAL not supported.
2013-03-08 15:50:43 [iNFO] [sTDOUT]     ERROR MESSAGE:
2013-03-08 15:50:43 [iNFO] [sTDOUT]         Could not locate OpenAL library.
2013-03-08 15:50:43 [iNFO] [sTDOUT]     STACK TRACE:
2013-03-08 15:50:43 [iNFO] [sTDOUT]         org.lwjgl.openal.AL.create(AL.java:153)
2013-03-08 15:50:43 [iNFO] [sTDOUT]         org.lwjgl.openal.AL.create(AL.java:104)
2013-03-08 15:50:43 [iNFO] [sTDOUT]         org.lwjgl.openal.AL.create(AL.java:191)
2013-03-08 15:50:43 [iNFO] [sTDOUT]         paulscode.sound.libraries.LibraryLWJGLOpenAL.init(SourceFile:164)
2013-03-08 15:50:43 [iNFO] [sTDOUT]         paulscode.sound.SoundSystem.CommandNewLibrary(SourceFile:1576)
2013-03-08 15:50:43 [iNFO] [sTDOUT]         paulscode.sound.SoundSystem.CommandQueue(SourceFile:2572)
2013-03-08 15:50:43 [iNFO] [sTDOUT]         paulscode.sound.CommandThread.run(SourceFile:121)
2013-03-08 15:50:43 [iNFO] [sTDOUT]     ERROR MESSAGE:
2013-03-08 15:50:43 [iNFO] [sTDOUT]         Could not locate OpenAL library.
2013-03-08 15:50:43 [iNFO] [sTDOUT] Starting up SoundSystem...
2013-03-08 15:50:44 [iNFO] [sTDOUT] Switching to No Sound
2013-03-08 15:50:44 [iNFO] [sTDOUT]     (Silent Mode)

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.