koca2000 / NoteBlockAPI

https://www.spigotmc.org/resources/noteblockapi.19287/
GNU Lesser General Public License v3.0
119 stars 40 forks source link

ArrayIndexOutOfBoundsException: Index 5 out of bounds for length 0 #75

Closed mibby closed 3 years ago

mibby commented 3 years ago

NoteBlockAPI dev 30 http://ci.haprosgames.com/job/NoteBlockAPI/

More errors noticed when playing random songs. https://paste.gg/p/anonymous/d1b82283707744a9a17318d5d4c57769/files/14a8edee85b14680847532d34aadf228/raw

[21:28:46] [Server thread/ERROR]: [NoteBlockAPI] Task #2077158 for NoteBlockAPI v1.6.1.1-SNAPSHOT generated an exception
[21:28:46] [Server thread/ERROR]: [NoteBlockAPI] Suspected Plugins: 
[21:28:46] [Server thread/ERROR]: [NoteBlockAPI]    MusicBox{enabled,ver=2.0.3,path=plugins/MusicBox-2.0.3-all.jar}
[21:28:46] [Server thread/ERROR]: [NoteBlockAPI]    NoteBlockAPI{enabled,ver=1.6.1.1-SNAPSHOT,path=plugins/NoteBlockAPI-1.6.1.1-SNAPSHOT.jar}
[21:28:46] [Server thread/ERROR]: [NoteBlockAPI] Exception details below: 
java.lang.ArrayIndexOutOfBoundsException: Index 5 out of bounds for length 0
    at com.xxmicloxx.NoteBlockAPI.model.playmode.MonoMode.play(MonoMode.java:38) ~[?:?]
    at com.xxmicloxx.NoteBlockAPI.songplayer.EntitySongPlayer.playTick(EntitySongPlayer.java:78) ~[?:?]
    at ru.spliterash.musicbox.customPlayers.objects.SpeakerPlayer.playTick(SpeakerPlayer.java:77) ~[?:?]
    at com.xxmicloxx.NoteBlockAPI.songplayer.SongPlayer.lambda$null$7(SongPlayer.java:441) ~[?:?]
    at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:100) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"5e10802"]
    at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:469) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"5e10802"]
    at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1386) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"5e10802"]
    at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:398) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"5e10802"]
    at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1295) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"5e10802"]
    at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1016) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"5e10802"]
    at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:176) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"5e10802"]
    at java.lang.Thread.run(Thread.java:832) [?:?]
koca2000 commented 3 years ago

Hi @mibby! The song that cause this error was probably created using OpenNoteBlockStudio v3.3.6 - v3.3.8. These versions had support for 1.14 instruments but were missing nbs format changes that are necessary to distinguish new instruments and custom instruments in songs with 1.12 instruments. As this issue were there only for a very short time I decided to set all songs with unknown version as 1.12 songs because that applies to majority.

The song can be fixed by saving it in newer version of OpenNoteBlockStudio (at least v3.4.0).

mibby commented 3 years ago

I'd assume that would also be the cause of Index 3 out of bounds for length 0 & Index 0 out of bounds for length 0 errors? Do you know if it's possible to catch the exception and output which file needs to be re-saved? Or if it's possible to bulk / batch re-save all .nbs songs against the newest OpenNoteBlockStudio version?

[17:17:52] [Server thread/ERROR]: [NoteBlockAPI] Task #10800102 for NoteBlockAPI v1.6.1.1-SNAPSHOT generated an exception
[17:17:52] [Server thread/ERROR]: [NoteBlockAPI] Suspected Plugins: 
[17:17:52] [Server thread/ERROR]: [NoteBlockAPI]    MusicBox{enabled,ver=2.0.3,path=plugins/MusicBox-2.0.3-all.jar}
[17:17:52] [Server thread/ERROR]: [NoteBlockAPI]    NoteBlockAPI{enabled,ver=1.6.1.1-SNAPSHOT,path=plugins/NoteBlockAPI-1.6.1.1-SNAPSHOT.jar}
[17:17:52] [Server thread/ERROR]: [NoteBlockAPI] Exception details below: 
java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 0
    at com.xxmicloxx.NoteBlockAPI.model.playmode.MonoMode.play(MonoMode.java:38) ~[?:?]
    at com.xxmicloxx.NoteBlockAPI.songplayer.EntitySongPlayer.playTick(EntitySongPlayer.java:78) ~[?:?]
    at ru.spliterash.musicbox.customPlayers.objects.SpeakerPlayer.playTick(SpeakerPlayer.java:77) ~[?:?]
    at com.xxmicloxx.NoteBlockAPI.songplayer.SongPlayer.lambda$null$7(SongPlayer.java:441) ~[?:?]
    at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:100) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"708cdc3"]
    at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:469) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"708cdc3"]
    at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1386) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"708cdc3"]
    at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:398) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"708cdc3"]
    at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1295) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"708cdc3"]
    at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1016) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"708cdc3"]
    at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:176) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"708cdc3"]
    at java.lang.Thread.run(Thread.java:832) [?:?]
[17:17:53] [Server thread/ERROR]: [NoteBlockAPI] Task #10800909 for NoteBlockAPI v1.6.1.1-SNAPSHOT generated an exception
[17:17:53] [Server thread/ERROR]: [NoteBlockAPI] Suspected Plugins: 
[17:17:53] [Server thread/ERROR]: [NoteBlockAPI]    MusicBox{enabled,ver=2.0.3,path=plugins/MusicBox-2.0.3-all.jar}
[17:17:53] [Server thread/ERROR]: [NoteBlockAPI]    NoteBlockAPI{enabled,ver=1.6.1.1-SNAPSHOT,path=plugins/NoteBlockAPI-1.6.1.1-SNAPSHOT.jar}
[17:17:53] [Server thread/ERROR]: [NoteBlockAPI] Exception details below: 
java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
    at com.xxmicloxx.NoteBlockAPI.model.playmode.MonoMode.play(MonoMode.java:38) ~[?:?]
    at com.xxmicloxx.NoteBlockAPI.songplayer.EntitySongPlayer.playTick(EntitySongPlayer.java:78) ~[?:?]
    at ru.spliterash.musicbox.customPlayers.objects.SpeakerPlayer.playTick(SpeakerPlayer.java:77) ~[?:?]
    at com.xxmicloxx.NoteBlockAPI.songplayer.SongPlayer.lambda$null$7(SongPlayer.java:441) ~[?:?]
    at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:100) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"708cdc3"]
    at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:469) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"708cdc3"]
    at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1386) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"708cdc3"]
    at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:398) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"708cdc3"]
    at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1295) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"708cdc3"]
    at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1016) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"708cdc3"]
    at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:176) ~[1.16.5-patched.jar:git-Yatopia-pr/upstream-"708cdc3"]
    at java.lang.Thread.run(Thread.java:832) [?:?]
koca2000 commented 3 years ago

That is all the same error only with different instruments. I added information about the song to log when exception occurs during playback. That should help you to identify the song.

mibby commented 3 years ago

I went ahead and re-saved every .nbs file I have on hand with OpenNoteBlockStudio v3.8.2's .nbs format 5. Besides old formats / songs that may have not loading properly, the only anomalies I came across was 1 using an .ogg instrument not part of vanilla MC / resource pack - which I just deleted - and a couple songs using minecraft .ogg sounds that have since been renamed. For example using entity.irongolem.step.ogg which became entity.iron_golem.step.ogg in a newer MC version. I couldn't figure out how to rename this instrument without just deleting it so I left it be. Playing it in-game didn't seem to cause any errors.

Is there any way to wrap old MC instrument / sounds to newer versions?

Here are all songs I have collected from various sources. You can use for testing or distribution. songs.zip

koca2000 commented 3 years ago

I thought OpenNoteBlockStudio allows custom instrument renaming. Maybe try to ask @Bentroen or visit OpenNoteBlockStudio Discord.

Thank you for songs. I'll close this issue as it is not really a bug.