-
Posts
16 -
Joined
-
Last visited
Converted
-
Gender
Male
-
Location
Canada
-
Personal Text
Just another average joe except I like programming
Xenocider's Achievements

Tree Puncher (2/8)
2
Reputation
-
Been about a day and still not a single reply… Any help would be appreciated
-
So I have absolutely no idea how to go about this. I have made GUIs before but now I wish to create one like in the creative menu. Also its not going to be a container I will have buttons of some sort that you can click on. I've found cpw.mods.fml.client.GuiScrollingList will I have to use something like this? If theres a tutorial could someone please point me to it or if not could you provide an example of this that is explained? Thanks!
-
[Solved] Getting Paulscode Source - IllegalArgumentException
Xenocider replied to Xenocider's topic in Modder Support
Thanks so much GotoLink! It works perfectly! I had absolutely no idea how to do a reflection, so thanks a lot! -
[Solved] Getting Paulscode Source - IllegalArgumentException
Xenocider replied to Xenocider's topic in Modder Support
I tried your suggestion to access it via reflection however it is throwing an IllegalArgumentException and I need some help. I'm not very experienced with reflection and so I had to read up on some tutorials before attempting it. public static Source getSource() throws NoSuchFieldException, SecurityException, InstantiationException, IllegalAccessException { Source theSource = null; LogHelper.info("Getting field..."); Field field = MainEventHandler.soundManager.sndSystem.getClass().getDeclaredField("soundLibrary"); if (field == null) {LogHelper.severe("The field is null!");} else { field.setAccessible(true); LogHelper.debug("Getting soundLibrary!"); Class<?> targetType = field.getType(); Object objectValue = targetType.newInstance(); Library soundLibrary = (Library) field.get(objectValue); if (soundLibrary == null) {LogHelper.severe("The soundLibrary is null!");} else { theSource = soundLibrary.getSource("BgMusic"); } } return theSource; } The crash log: -
I been reading through Paulscode 3D SoundSystem Library http://www.paulscode.com/docs/SoundSystem/overview-summary.html and I can't find a way to get from Minecraft's SoundSystem to it's Library and then running .getSource("BgMusic").getSoundSequenceQueueSize(); This get's the java.lang.Class Library: soundManager.sndSystem.currentLibrary() is there a way from this point to run the Method .getSource()? I have looked at .getMethod() and .getMethods() but I can't quite understand what I can do with them. Any help, tips or ideas would be most appreciated! Thanks!
-
Console Log: This happened right after I ran the code: public void playMusic(SoundPoolEntry currentSong) { currentSong = SoundEvent.getResult(new PlayBackgroundMusicEvent(this, currentSong)); if (currentSong != null) { this.sndSystem.backgroundMusic("BgMusic", currentSong.getSoundUrl(), currentSong.getSoundName(), false); this.sndSystem.setVolume("BgMusic", this.options.musicVolume); this.sndSystem.play("BgMusic"); } } currentSong's URL is: file:/Development/Minecraft/forge/mcp/jars/./Music/IRemember.ogg currentSong's Name is: IRemember.ogg EDIT: I think the problem might have to do with my .ogg file. (I converted it from .mp3 to .ogg) Going to try converting it with another program to see if there is any difference. EDIT: Yes it did! Turns out that the original program I used was the problem.
-
You may be right about that. I was assuming you were making the mod for 1.6. If that is the case then I might not be able to help. I'll try to see how it's done in 1.5 but you are probably better off if someone more comfortable with 1.5 could help.
-
Thats not how the string works. "money.update" would make Minecraft look in assets/Minecraft/sound/money for the update sound file. Make an assets/[mod_id]/sound/money package and put in your update sound file in there. Replace [mod_id] with the mod id of your mod and change "money.update" to "[mod_id]:money.update". Minecraft.getMinecraft().theWorld.playSoundAtEntity(Minecraft.getMinecraft().thePlayer, "[mod_id]:money.update", 20F, 1F); You will also need to change e.manager.addSound("money/update.wav", new File(VoltzationClient.class.getResource("/mods/voltzationclient/sounds/update.wav").getFile())); to e.manager.addSound("[mod_id]:money/update.ogg");
-
Try registering the EventHandler during preInit @PreInit public void preInit(final FMLPreInitializationEvent e) { //Config.initialize(e.getSuggestedConfigurationFile()); MinecraftForge.EVENT_BUS.register(new EventHandler()); }
-
Thank you! It was the event.result that was continuously running the event. Changing it to event.source solved it!
-
Yeah it is looping PlayBackgroundMusicEvent for some reason. I edited my reply right when you replied. Any ideas why this is happening and how could I fix it?
-
No goToNextSong() just makes it so that the next time it runs playMusic(MusicHandler.currentSong) it will play the next song after it. I'm not the best at naming my methods and variables. This is what happens in goToNextSong: public static void goToNextSong() { if (currentSong == null || currentSongInt == MainEventHandler.musicSoundPoolEntryArray.length) {currentSong = MainEventHandler.musicSoundPoolEntryArray[0]; currentSongInt = 0;} else { currentSong = MainEventHandler.musicSoundPoolEntryArray[currentSongInt + 1]; currentSongInt = currentSongInt + 1; } LogHelper.info("Going to next song."); } EDIT: I added a logger to the PlayBackgroundMusicEvent and it was spammed a lot of times before the game crashed. So somehow the PlayBackgroundMusicEvent keeps on getting triggered in a endless loop.
-
I need some help understanding what caused Minecraft to crash. Crash: The crash was triggered after the code MainEventHandler.soundManager.playMusic(MusicHandler.currentSong); was run. Some of my code that I think might be the problem: EventListener Class: @ForgeSubscribe public void onPlayBackgroundMusic(PlayBackgroundMusicEvent event) { SoundPoolEntry playingSong = SoundEvent.getResult(event); if (playingSong.getSoundName() == MusicHandler.currentSong.getSoundName()) { MusicHandler.goToNextSong(); } } Base Class SoundManager modified code: public void playMusic(SoundPoolEntry currentSong) { currentSong = SoundEvent.getResult(new PlayBackgroundMusicEvent(this, currentSong)); if (currentSong != null) { this.sndSystem.backgroundMusic("BgMusic", currentSong.getSoundUrl(), currentSong.getSoundName(), false); this.sndSystem.setVolume("BgMusic", this.options.musicVolume); this.sndSystem.play("BgMusic"); } } Anything that would help understand what caused the StackOverflow error would be appreciated. Thanks!
-
The only tutorial I can find is http://www.minecraftforge.net/wiki/Using_Access_Transformers and I completely understand it but it doesn't go any farther into editing methods. If there is another tutorial that I could look at it would really help and if not could someone explain how I would go around editing a method.
-
Anyone have any ideas or tips to look at? I know about playBackgroundMusicEvent. Is there any way to control when it plays and what it plays.