Menu principal : - Bouton "Join Discord" (logo Discord lissé + texte) sous "Rejoindre SurviePote", ouvre https://discord.gg/EpkgEPv5c. - "Options..." et "Quit Game" remplacés par des boutons icônes sans texte (engrenage / symbole power) qui conservent l'action du bouton vanilla (ButtonAccessor -> onPress). - Panneau de statut du serveur en haut à gauche : En ligne / Hors ligne, joueurs current/max et ping. Attention : dans ServerStatusPinger.pingServer les 2 Runnable ne sont pas des callbacks succès/échec (le 1er ne fire que si le favicon change, le 2nd est le pong) -> on lit directement ServerData.status ("0/20" quand le statut est arrivé, vidé en cas d'échec) + timeout 8s. - Suppression du texte "26.3 mc" (bas à gauche) : le mixin TitleScreenTextMixin qui le dessinait est supprimé, la redirection masque le texte de version. - Suppression du splash, du logo Mojang, des boutons amis/icônes et du copyright (TitleScreenMixin : FriendsButton/SpriteIconButton/PlainTextButton sont des sous-classes de Button, ils étaient avalés par "instanceof Button"). Icônes : PNG lisses 64x64 (supersampling 8x8) au lieu du pixel art. Chargement des textures du mod via ModTextures (les assets des mods ne sont plus exposés au ResourceManager en MC 26.3).
164 lines
7.1 KiB
Groovy
164 lines
7.1 KiB
Groovy
// SurviePote - nosingleplayer : build SANS loom.
|
|
// MC 26.3 n'est plus obfusqué (noms Mojang lisibles dans le jar vanilla) et Mojang ne
|
|
// publie plus de mappings (pas de client_mappings/server_mappings, pas de Yarn 26.x).
|
|
// On compile directement contre le jar client Mojang + loader/mixin en compileOnly.
|
|
plugins {
|
|
id 'java'
|
|
}
|
|
|
|
version = project.mod_version
|
|
group = project.maven_group
|
|
|
|
base {
|
|
archivesName = project.archives_base_name
|
|
}
|
|
|
|
def mcDir = layout.buildDirectory.dir('mc')
|
|
|
|
tasks.register('downloadMcLibs') {
|
|
def manifestUrl = 'https://piston-meta.mojang.com/mc/game/version_manifest_v2.json'
|
|
def mcVersion = project.minecraft_version
|
|
def loaderVersion = project.loader_version
|
|
outputs.dir(mcDir)
|
|
doLast {
|
|
def outDir = mcDir.get().asFile
|
|
outDir.mkdirs()
|
|
def dl = { String url, File dest ->
|
|
if (!dest.exists()) {
|
|
println "Téléchargement ${dest.name} ..."
|
|
new URL(url).withInputStream { i -> dest.withOutputStream { it << i } }
|
|
}
|
|
}
|
|
def manifest = new groovy.json.JsonSlurper().parse(new URL(manifestUrl))
|
|
def entry = manifest.versions.find { it.id == mcVersion }
|
|
if (entry == null) throw new GradleException("Version MC introuvable : ${mcVersion}")
|
|
def versionJson = new groovy.json.JsonSlurper().parse(new URL(entry.url))
|
|
dl(versionJson.downloads.client.url, new File(outDir, 'client.jar'))
|
|
dl("https://maven.fabricmc.net/net/fabricmc/fabric-loader/${loaderVersion}/fabric-loader-${loaderVersion}.jar",
|
|
new File(outDir, 'fabric-loader.jar'))
|
|
dl('https://maven.fabricmc.net/net/fabricmc/sponge-mixin/0.17.5+mixin.0.8.7/sponge-mixin-0.17.5+mixin.0.8.7.jar',
|
|
new File(outDir, 'sponge-mixin.jar'))
|
|
dl('https://repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.17/slf4j-api-2.0.17.jar',
|
|
new File(outDir, 'slf4j-api.jar'))
|
|
dl('https://libraries.minecraft.net/com/mojang/brigadier/1.3.11/brigadier-1.3.11.jar',
|
|
new File(outDir, 'brigadier.jar'))
|
|
// Annotations JSpecify : referencées par les signatures de MC 26.3 (@Nullable...).
|
|
dl('https://repo1.maven.org/maven2/org/jspecify/jspecify/1.0.0/jspecify-1.0.0.jar',
|
|
new File(outDir, 'jspecify.jar'))
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
compileOnly files({ tasks.named('downloadMcLibs').map { mcDir.get().asFile.listFiles().findAll { it.name.endsWith('.jar') } } })
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
it.options.release = 25
|
|
it.dependsOn('downloadMcLibs')
|
|
}
|
|
|
|
processResources {
|
|
inputs.property 'version', project.version
|
|
filesMatching('fabric.mod.json') {
|
|
expand 'version': project.version
|
|
}
|
|
}
|
|
|
|
java {
|
|
withSourcesJar()
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Dev : lance le vrai client MC 26.3 + nosingleplayer (build sans loom).
|
|
// Réutilise l'installation commune du launcher SurviePote (~/.surviepote/common :
|
|
// versions, libraries, assets — remplie au premier lancement). Le mod est copié
|
|
// dans runClient/game/mods/ (Knot le découvre comme un mod Fabric classique).
|
|
// Usage : ./gradlew runClient
|
|
// ---------------------------------------------------------------------------
|
|
def survieCommon = new File(System.getProperty('user.home'), '.surviepote/common')
|
|
def mcVersion = project.minecraft_version
|
|
def loaderVersion = project.loader_version
|
|
|
|
tasks.register('extractClientNatives', Copy) {
|
|
def versionJson = new groovy.json.JsonSlurper().parse(
|
|
new File(survieCommon, "versions/${mcVersion}/${mcVersion}.json"))
|
|
from(versionJson.libraries.findAll { lib ->
|
|
lib.name.contains(':natives-linux') && (lib.rules == null || lib.rules.any { it.action == 'allow' && (it.os == null || it.os.name == 'linux') })
|
|
}.collect { lib ->
|
|
zipTree(new File(survieCommon, "libraries/${lib.downloads.artifact.path}"))
|
|
})
|
|
into(layout.buildDirectory.dir('runClient/natives'))
|
|
include('**/*.so')
|
|
eachFile { f -> f.path = f.name }
|
|
}
|
|
|
|
tasks.register('runClient', JavaExec) {
|
|
dependsOn('extractClientNatives', 'jar')
|
|
group = 'fabric'
|
|
description = 'Lance le client Minecraft avec le mod (dev visuel, sans loom).'
|
|
|
|
def versionJson = new groovy.json.JsonSlurper().parse(
|
|
new File(survieCommon, "versions/${mcVersion}/${mcVersion}.json"))
|
|
def fabricJson = new groovy.json.JsonSlurper().parse(
|
|
new File(survieCommon, "versions/${mcVersion}-fabric-${loaderVersion}/${mcVersion}-fabric-${loaderVersion}.json"))
|
|
def mavenToPath = { String coord ->
|
|
def parts = coord.split(':')
|
|
return "${parts[0].replace('.', '/')}/${parts[1]}/${parts[2]}/${parts[1]}-${parts[2]}.jar"
|
|
}
|
|
|
|
doFirst {
|
|
def modsDir = layout.buildDirectory.dir('runClient/game/mods').get().asFile
|
|
delete(modsDir)
|
|
modsDir.mkdirs()
|
|
copy {
|
|
from(tasks.named('jar'))
|
|
into(modsDir)
|
|
}
|
|
}
|
|
|
|
// 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) }
|
|
classpath = files(
|
|
new File(survieCommon, "versions/${mcVersion}/${mcVersion}.jar"),
|
|
versionJson.libraries.findAll { lib ->
|
|
!(lib.name.contains(':natives-')) && (lib.rules == null || lib.rules.any { it.action == 'allow' && (it.os == null || it.os.name == 'linux') })
|
|
}.collect { new File(survieCommon, "libraries/${it.downloads.artifact.path}") },
|
|
fabricJson.libraries.collect { new File(survieCommon, "libraries/${mavenToPath(it.name)}") }
|
|
)
|
|
mainClass = 'net.fabricmc.loader.impl.launch.knot.KnotClient'
|
|
args = [
|
|
'--gameDir', layout.buildDirectory.dir('runClient/game').get().asFile.absolutePath,
|
|
'--assetsDir', new File(survieCommon, 'assets').absolutePath,
|
|
'--assetIndex', versionJson.assetIndex.id,
|
|
'--version', "${project.archives_base_name}-dev",
|
|
'--username', 'Dev', '--uuid', '00000000-0000-0000-0000-000000000000',
|
|
'--accessToken', '0', '--versionType', 'release'
|
|
]
|
|
jvmArgs = [
|
|
"-Djava.library.path=${layout.buildDirectory.dir('runClient/natives').get().asFile.absolutePath}",
|
|
'-Xmx4G'
|
|
]
|
|
systemProperties['org.lwjgl.util.Debug'] = 'false'
|
|
}
|