Jump to content

Recommended Posts

Posted (edited)

Hi! I've got little problem. Each time my music is starting to playing, minecraft got one lag spike (like resource loading spike). Then the music normally plays. Is there any way to solve it?

Event class

  Reveal hidden contents

 

Client Proxy

  Reveal hidden contents

 

Event register (in mod main class)

  Reveal hidden contents

 

Sounds.json

  Reveal hidden contents

There is no error during loading sounds.json (in console)

 

SoundHelper

  Reveal hidden contents

 

SoundEventHandlerMystic

  Reveal hidden contents

 

Edited by Krevik
Code update
Posted
  On 4/17/2018 at 4:20 PM, diesieben07 said:

Set stream to true in your sounds.json.

Expand  

Didn't help. Also I noticed that after few minutes of playing this sound (maybe 1/2 minutes) the game crashes. Here's the log

  Quote
[19:17:12] [Server thread/INFO]: Stopping server
[19:17:12] [Server thread/INFO]: Saving players
[19:17:12] [Server thread/INFO]: Saving worlds
[19:17:12] [Server thread/INFO]: Saving chunks for level 'New World'/overworld
[19:17:12] [Server thread/INFO]: Saving chunks for level 'New World'/the_nether
[19:17:12] [Server thread/INFO]: Saving chunks for level 'New World'/the_end
[19:17:12] [Server thread/INFO]: Saving chunks for level 'New World'/MYSTIC
[19:17:14] [main/FATAL]: Unreported exception thrown!
java.lang.IllegalArgumentException: value already present: net.minecraft.client.audio.PositionedSoundRecord@a548a06
	at com.google.common.collect.HashBiMap.put(HashBiMap.java:287) ~[guava-21.0.jar:?]
	at com.google.common.collect.HashBiMap.put(HashBiMap.java:262) ~[guava-21.0.jar:?]
	at net.minecraft.client.audio.SoundManager.playSound(SoundManager.java:453) ~[SoundManager.class:?]
	at net.minecraft.client.audio.SoundHandler.playSound(SoundHandler.java:261) ~[SoundHandler.class:?]
	at net.minecraft.client.audio.MusicTicker.playMusic(MusicTicker.java:61) ~[MusicTicker.class:?]
	at net.minecraft.client.audio.MusicTicker.update(MusicTicker.java:51) ~[MusicTicker.class:?]
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1982) ~[Minecraft.class:?]
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1186) ~[Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:441) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_162]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_162]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_162]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_162]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_162]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_162]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_162]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_162]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:25) [start/:?]

 

Expand  

 

Posted (edited)
  On 4/17/2018 at 5:37 PM, diesieben07 said:

This will never be true.

Also, you would be better off overriding getMusicType in your WorldProvider if you want to add custom music to your dimension.

 

Your sounds.json is invalid JSON.

Expand  

The music normally plays so I thought this is true. Can be json invalid, even if there's no error log in console during loading? Could you point me the place this is wrong? Yea I used this method before but after updating forge to latest version there is no such method in WorldProvider - it's just deleted. Also there is no such method in latest forge version as EnumHelperClient.addMusicType. This lag occured even with using getMusicType in WorldProvider instead of using event.

Edited by Krevik
edited
Posted
  On 4/18/2018 at 4:49 PM, ZombieEnderman5 said:

Do you have a low RAM amount? If so, that can contribute to lag (believe me, I know. My computer has frozen completely for several minutes at a time due to Minecraft using too much memory).

Expand  

Hmm low RAM amount shouldn't be problem anyway. I have 8gb DDR4. Minecraft in eclipse has it's default - 1gb. I would change it to higher, but I think that most minecraft players have default. I want these "most minecraft players" to have comfortable conditions to use my mod.

Posted (edited)
  On 4/18/2018 at 9:38 PM, diesieben07 said:

You did not specify the stream setting properly. See https://minecraft.gamepedia.com/Sounds.json for the sounds.json structure.

Expand  

Searched for some example, found it and updated sounds.json. Now it works nice. Got next problem that I didn't notice last time.. After some time minecraft starts to playing two musics at the same time... But I think that I can fix that myself,  so thanks everyone for help!

Edited by Krevik
edited

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.