Lunar Client 1.8.9 crash // ArrayIndexOutOfBoundsException

I was having persistent issues when trying to launch Minecraft version 1.8.9 or lower specifically through Lunar Client while the official Minecraft launcher worked fine and after a few quick searches I found a solution that I just wanted to post here in case it could help anybody facing the same issue.

The following is the error:

[2024-03-11 15:11:28.638] [info]  ---- Minecraft Crash Report ----
[2024-03-11 15:11:28.639] [info]  // Don't be sad, have a hug! <3
[2024-03-11 15:11:28.639] [info]  
[2024-03-11 15:11:28.639] [info]  Time: 2024-03-11 15:11
[2024-03-11 15:11:28.639] [info]  Description: Initializing game
[2024-03-11 15:11:28.639] [info]  
[2024-03-11 15:11:28.639] [info]  java.lang.ExceptionInInitializerError
[2024-03-11 15:11:28.639] [info]  	at Genesis//net.optifine.Config.getDisplayModes(Config.java:1864)
[2024-03-11 15:11:28.640] [info]  	at Genesis//net.minecraft.client.settings.GameSettings$Options.<clinit>(GameSettings.java:3384)
[2024-03-11 15:11:28.640] [info]  	at Genesis//net.minecraft.client.settings.GameSettings.<init>(GameSettings.java:313)
[2024-03-11 15:11:28.640] [info]  	at Genesis//net.minecraft.client.Minecraft.startGame(SourceFile:349)
[2024-03-11 15:11:28.640] [info]  	at Genesis//net.minecraft.client.Minecraft.run(SourceFile:310)
[2024-03-11 15:11:28.640] [info]  	at Genesis//net.minecraft.client.main.Main.main(SourceFile:124)
[2024-03-11 15:11:28.640] [info]  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2024-03-11 15:11:28.640] [info]  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[2024-03-11 15:11:28.640] [info]  	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[2024-03-11 15:11:28.641] [info]  	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
[2024-03-11 15:11:28.641] [info]  	at com.moonsworth.lunar.genesis.ClientGameBootstrap.apply(Unknown Source)
[2024-03-11 15:11:28.641] [info]  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2024-03-11 15:11:28.641] [info]  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[2024-03-11 15:11:28.641] [info]  	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[2024-03-11 15:11:28.641] [info]  	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
[2024-03-11 15:11:28.641] [info]  	at com.moonsworth.lunar.genesis.OICRRRIHIRORRICRRHICIIHRI.CHIOOIIOHRCIOCRICROCIIORO(Unknown Source)
[2024-03-11 15:11:28.641] [info]  	at com.moonsworth.lunar.genesis.Genesis.run(Unknown Source)
[2024-03-11 15:11:28.642] [info]  	at com.moonsworth.lunar.genesis.Genesis.main(Unknown Source)
[2024-03-11 15:11:28.642] [info]  Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
[2024-03-11 15:11:28.642] [info]  	at Genesis//org.lwjgl.opengl.LinuxDisplay.getAvailableDisplayModes(LinuxDisplay.java:951)
[2024-03-11 15:11:28.642] [info]  	at Genesis//org.lwjgl.opengl.LinuxDisplay.init(LinuxDisplay.java:738)
[2024-03-11 15:11:28.642] [info]  	at Genesis//org.lwjgl.opengl.Display.<clinit>(Display.java:138)
[2024-03-11 15:11:28.642] [info]  	... 18 more

Turns out that a missing dependency can cause this exception, and at least for me, installing xorg-xrandr fixed it.

sudo pacman -S xorg-xrandr