Is there a relevant github for this tutorial if not would you be willing to make one as I seem to have caused mobs to spin and fly upwards and make the game think I am in water at all times.
The tutorial is not showing whole class files and it's not on github.
It's written in a manner which those meeting the simple prerequsites should be able to follow
Mazetar, there is an other way to add the register the sound, and its a little bit easier.
Can I send the code, so the people have 2 methodes to do this
Now on to the block. I will not cover how it's initialized as it's the same as any other block.
Just make sure it's after the respective fluid is initialized.
I am working on a small mod to kind of take a break from the main mod I work on and I need some help with the sounds...I am recreating the note block to eventually add in more instrument sounds so more can be done with noteblock music fun....basically I copied the block and tile and registered my sound handler and then added sounds...but I get no sound from the noteblock...it does work fine if I add the sounds to the base classes and sounds to the base sound folder...so I know my sounds are good. I have my folder set up in assets/notemod/sound/...
Hey Mazetar, I have made a mod before with custom sounds with an entity, but never when an item is right clicked. Here is my item class (by the way, I've only been modding for 5 months, so yeah xD): http://pastebin.com/C3J85xeT
The sound isn't playing at all. It doesn't give me any errors, but it doesn't play the sound. do I need to register the sound handler in pre-init? or is post-init ok?
Hey Maz Do you know if there is any way to add all sounds in the sound directory automatically, as in without writing 'event.manager.addSound("filename") for every single sound file? I'm sure there must be.
The Meaning of Life, the Universe, and Everything.
Join Date:
5/19/2013
Posts:
54
Member Details
Hey Maz, fantastic sounds tutorial. As far as I can tell you're the only one out there who's bothered to put together a succinct explanation of the 1.6 forge sound process and I really appreciate it, it's been a huge help.
However I'm gonna jump on the pile here with my own unexplained error that I'm running into. It might be the same issue that Icedice9 was running into in post #42 here but unlike they were doing I'm not putting anything in the jar, I'm working in Eclipse and putting all resources into /forge/mcp/src/minecraft/assets/freeradicalx-mobs/ (They show up in Eclipse). I'm near certain that everything is in the right place because if I change any of the paths in my code I get no errors at all, just silence. So clearly the game sees my resources and then freaks out at something.
Errors first, then my class files.
Error displayed as soon as my custom mob needs to make a noise:
2013-12-28 18:54:22 [INFO] [STDERR] Exception in thread "Thread-10" java.lang.NullPointerException
2013-12-28 18:54:22 [INFO] [STDERR] at paulscode.sound.codecs.CodecJOrbis.readHeader(CodecJOrbis.java:448)
2013-12-28 18:54:22 [INFO] [STDERR] at paulscode.sound.codecs.CodecJOrbis.initialize(CodecJOrbis.java:301)
2013-12-28 18:54:22 [INFO] [STDERR] at paulscode.sound.libraries.LibraryLWJGLOpenAL.loadSound(LibraryLWJGLOpenAL.java:392)
2013-12-28 18:54:22 [INFO] [STDERR] at paulscode.sound.libraries.LibraryLWJGLOpenAL.newSource(LibraryLWJGLOpenAL.java:640)
2013-12-28 18:54:22 [INFO] [STDERR] at paulscode.sound.SoundSystem.CommandNewSource(SoundSystem.java:1800)
2013-12-28 18:54:22 [INFO] [STDERR] at paulscode.sound.SoundSystem.CommandQueue(SoundSystem.java:2415)
2013-12-28 18:54:22 [INFO] [STDERR] at paulscode.sound.CommandThread.run(CommandThread.java:121)
Crash upon trying to exit Minecraft, and sometimes it just crashes spontaniously with this:
2013-12-28 18:54:29 [INFO] [STDOUT] Error in class 'SoundSystem'
2013-12-28 18:54:29 [INFO] [STDOUT] Command thread did not die!
2013-12-28 18:54:29 [INFO] [STDOUT] Ignoring errors... continuing clean-up.
2013-12-28 18:54:29 [INFO] [STDOUT] Author: Paul Lamb, www.paulscode.com
2013-12-28 18:54:29 [INFO] [STDOUT]
My main mod class
package freeradicalx.vehicles;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import freeradicalx.vehicles.lib.Reference;
@Mod(
modid = Reference.MOD_ID,
name = Reference.MOD_NAME,
version = Reference.MOD_VERSION)
@NetworkMod(
serverSideRequired = false,
clientSideRequired = true)
public class Vehicles {
@SidedProxy
(clientSide = "freeradicalx.vehicles.VehiclesClientProxy", serverSide = "freeradicalx.vehicles.VehiclesServerProxy")
public static VehiclesCommonProxy proxy;
@EventHandler
public void load(FMLInitializationEvent event){
proxy.registerRenderers();
proxy.registerSounds();
EntityRegistry.registerModEntity(EntityTestMob.class, "testmob", 1, this, 80, 5, true);
for (int i = 0; i < BiomeGenBase.biomeList.length; i++)
{
if (BiomeGenBase.biomeList[i] != null)
{
EntityRegistry.addSpawn(EntityTestMob.class, 10, 1, 3, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
}
}
LanguageRegistry.instance().addStringLocalization("entity.testmob.name", "Test Mob");
}
}
My sounds class:
package freeradicalx.vehicles;
import net.minecraftforge.client.event.sound.SoundLoadEvent;
import net.minecraftforge.event.*;
public class VehiclesSounds {
@ForgeSubscribe
public void load(SoundLoadEvent event) {
event.manager.addSound("freeradicalx-mobs:sound/mob/bloopbloop.ogg");
}
}
package freeradicalx.vehicles;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class VehiclesClientProxy extends VehiclesCommonProxy {
@Override
public void registerRenderers(){
float shadowSize = 0.5F;
RenderingRegistry.registerEntityRenderingHandler(EntityTestMob.class, new RenderTestMob(new ModelTestMob(), shadowSize));
}
public void registerSounds(){
MinecraftForge.EVENT_BUS.register(new VehiclesSounds());
}
}
Any idea what I'm doing wrong here? Thanks again.
EDIT: This is the exact same error that Taji34 was running into over at the Forge forums. I see you were helping them with this over there but no one ever posted a solution in that thread. Like Taji I also tried substituting other .ogg and .wav files from all different sources to make sure the problem wasn't my ogg file.
ANOTHER EDIT: If I put println()s in my entity's getLivingSound(), getHurtSound() and getDeathSound() it floods the console, which means there are copies of my entities out there making noises. No errors come up in the meantime. The error only comes up when one of these noises should be audible to the player.
It was because you had 'sound'/ in your file path; sound filepaths should look exactly like texture filepaths, as in "modid:filename", of course denoting any subfolder beyond 'sound/'. Also, you don't need to add soundPoolSounds
The Meaning of Life, the Universe, and Everything.
Join Date:
5/19/2013
Posts:
54
Member Details
Heh, indeed that was the issue. Thank you again, coolAlias
I was stuck on this one for HOURS, in part because I was convinced that "event.manager.addSound("freeradicalx-mobs:sound/mob/bloopbloop.ogg");" WAS registering the sound file due to the fact that I was getting errors when using it and not any other alternative file path. I think Forge might be a little lenient there and cut off the sounds/ part of the file path for you in case you add it, but it doesn't grant you that allowance when you call for the sound later on. Funny how one occasionally gets hung up on unverified assumptions and wastes so much time! Good thing it's Saturday.
EDIT: Oh! And I came across this tutorial while troubleshooting that shows a way to add all sounds via a single sound registry loop in a "SoundHandler" class. I'm sure it could be easily modified to count and list all the sound files in a particular folder to allow the "bulk registration" you're trying to do.
EDIT: Oh! And I came across this tutorial while troubleshooting that shows a way to add all sounds via a single sound registry loop in a "SoundHandler" class. I'm sure it could be easily modified to count and list all the sound files in a particular folder to allow the "bulk registration" you're trying to do.
That is indeed one way to do it, but I was hoping there was a way to automate it by getting all the files in the directory directly rather than adding an extra static declaration (well, a whole array full of them). Thanks for the link though! If I get some free time to work out how to do it, I'll be sure to post it on here.
@CoolAlias:
That is very much possible, at least to load them all into the mod.
Heres part of what I used to load textures dynamicly, it could probably do just as well with sounds.
URL url = PlayMod.class.getResource("/assets/playmod/textures/blocks/");
try {
String[] files = new File(url.toURI()).list();
if (files!= null && files.length > 0)
{
for (int i = 0; i < files.length; i++)
{
// DO STUFF
}
}
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
PlayMod is the @Mod class and playmod is the modid.
Edit: My configs weren't working properly oops!
It's written in a manner which those meeting the simple prerequsites should be able to follow
Hmm thats a rather funny error though
Can I send the code, so the people have 2 methodes to do this
How do I initialize it?
http://docs.oracle.com/javase/tutorial/java/index.html
the rest is explained here with code...
Find out how I generate....coolAlias...world structure generation and rotation tool...
Find out how I generate....coolAlias...world structure generation and rotation tool...
www.minecraftforge.net/wiki/Basic_Modding
Here is my ClientProxy (some of it is used for armor potion effects): http://pastebin.com/77DFm0gZ
And here is my FirefighterModSoundEvents class: http://pastebin.com/x0PKMyzp
Thank you for posting these tutorials, and they are very good. Please get back with me as soon as possible, as I really want to finish my next mod.
However I'm gonna jump on the pile here with my own unexplained error that I'm running into. It might be the same issue that Icedice9 was running into in post #42 here but unlike they were doing I'm not putting anything in the jar, I'm working in Eclipse and putting all resources into /forge/mcp/src/minecraft/assets/freeradicalx-mobs/ (They show up in Eclipse). I'm near certain that everything is in the right place because if I change any of the paths in my code I get no errors at all, just silence. So clearly the game sees my resources and then freaks out at something.
Errors first, then my class files.
Error displayed as soon as my custom mob needs to make a noise:
Crash upon trying to exit Minecraft, and sometimes it just crashes spontaniously with this:
My main mod class
My sounds class:
My custom mob class:
My client proxy:
Any idea what I'm doing wrong here? Thanks again.
EDIT: This is the exact same error that Taji34 was running into over at the Forge forums. I see you were helping them with this over there but no one ever posted a solution in that thread. Like Taji I also tried substituting other .ogg and .wav files from all different sources to make sure the problem wasn't my ogg file.
ANOTHER EDIT: If I put println()s in my entity's getLivingSound(), getHurtSound() and getDeathSound() it floods the console, which means there are copies of my entities out there making noises. No errors come up in the meantime. The error only comes up when one of these noises should be audible to the player.
When I was calling:
I actually needed:
(Not sure if calling .soundPoolSounds's addSound method is necessary, but it works.)
And when I was calling:
I actually needed:
It was because you had 'sound'/ in your file path; sound filepaths should look exactly like texture filepaths, as in "modid:filename", of course denoting any subfolder beyond 'sound/'. Also, you don't need to add soundPoolSounds
I was stuck on this one for HOURS, in part because I was convinced that "event.manager.addSound("freeradicalx-mobs:sound/mob/bloopbloop.ogg");" WAS registering the sound file due to the fact that I was getting errors when using it and not any other alternative file path. I think Forge might be a little lenient there and cut off the sounds/ part of the file path for you in case you add it, but it doesn't grant you that allowance when you call for the sound later on. Funny how one occasionally gets hung up on unverified assumptions and wastes so much time! Good thing it's Saturday.
EDIT: Oh! And I came across this tutorial while troubleshooting that shows a way to add all sounds via a single sound registry loop in a "SoundHandler" class. I'm sure it could be easily modified to count and list all the sound files in a particular folder to allow the "bulk registration" you're trying to do.
That is indeed one way to do it, but I was hoping there was a way to automate it by getting all the files in the directory directly rather than adding an extra static declaration (well, a whole array full of them). Thanks for the link though! If I get some free time to work out how to do it, I'll be sure to post it on here.
That is very much possible, at least to load them all into the mod.
Heres part of what I used to load textures dynamicly, it could probably do just as well with sounds.
PlayMod is the @Mod class and playmod is the modid.