diff --git a/mods/pala/build.gradle b/mods/pala/build.gradle index 7e57d81..ad71192 100644 --- a/mods/pala/build.gradle +++ b/mods/pala/build.gradle @@ -122,6 +122,31 @@ tasks.register('runClient', JavaExec) { description = 'Lance le client Minecraft avec le mod (dev visuel).' doFirst { layout.buildDirectory.dir('runClient/game/mods').get().asFile.mkdirs() + copy { + from(tasks.named('jar')) + into(layout.buildDirectory.dir('runClient/game/mods')) + } + } + // NixOS : dlopen ne voit ni libGL ni libvulkan sans LD_LIBRARY_PATH (cf launcher). + def nixStore = new File('/nix/store') + def glDirs = [] + ['/run/opengl-driver/lib', '/run/current-system/sw/lib'].each { d -> + if (new File(d).exists()) glDirs << d + } + if (nixStore.exists()) { + nixStore.eachDir { e -> + def n = e.name + if (n.contains('libglvnd') || n.contains('vulkan-loader') || n.contains('alsa-lib') + || n.contains('pulseaudio') || (n.contains('pipewire') && !n.contains('python'))) { + def lib = new File(e, 'lib') + if (lib.exists()) glDirs << lib.absolutePath + } + } + } + def prevLd = System.getenv('LD_LIBRARY_PATH') + environment('LD_LIBRARY_PATH', (prevLd ? prevLd + ':' : '') + glDirs.join(':')) + if (!System.getenv('SDL_VIDEODRIVER') && (System.getenv('WAYLAND_DISPLAY') || new File('/run/user/1000/wayland-1').exists())) { + environment('SDL_VIDEODRIVER', 'wayland') } javaLauncher = javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(25) } def mcVersion = project.minecraft_version