Files
Not-Enough-Crashes/1.12.2/build.gradle
Claude ff04a40c1d Add 1.12.2 Forge backport with CI build
Reimplements the core Not Enough Crashes features for Minecraft 1.12.2 on
the legacy Forge toolchain (ForgeGradle 2.3, MCP mappings, SpongePowered
Mixin), since Architectury/Fabric/Yarn do not support 1.12.2.

Features:
- Catches client game-loop crashes and shows a recoverable crash screen
  instead of closing the game (return to title / quit / open report).
- Blames the mod most likely responsible by mapping stack-trace classes
  back to their owning mod.
- Adds a Suspected Mods line to every crash report (client and server).

Mixin is shaded and bootstrapped by a small Forge core plugin. A GitHub
Actions workflow (.github/workflows/build-1.12.2.yml) builds it on JDK 8.
2026-06-03 17:18:32 +00:00

100 lines
3.1 KiB
Groovy

buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net' }
maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
mavenCentral()
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3.+'
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'org.spongepowered.mixin'
version = project.mod_version
group = 'fudge.notenoughcrashes'
archivesBaseName = 'notenoughcrashes'
sourceCompatibility = targetCompatibility = '1.8'
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
options.encoding = 'UTF-8'
}
minecraft {
version = project.forge_version
runDir = 'run'
mappings = project.mappings_version
makeObfSourceJar = false
}
repositories {
maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
}
configurations {
embed
compile.extendsFrom(embed)
}
dependencies {
embed("org.spongepowered:mixin:${mixin_version}") {
// launchwrapper is provided by Forge at runtime
exclude module: 'launchwrapper'
exclude module: 'guava'
exclude module: 'gson'
exclude module: 'commons-io'
exclude module: 'log4j-core'
}
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
}
mixin {
defaultObfuscationEnv searge
add sourceSets.main, 'mixins.notenoughcrashes.refmap.json'
}
processResources {
inputs.property 'version', project.version
inputs.property 'mcversion', '1.12.2'
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version': project.version, 'mcversion': '1.12.2'
}
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
jar {
// Shade the Mixin library so the mod is self-contained at runtime.
// module-info.class and the ModLauncher (1.13+) integration classes are compiled to Java 16,
// which ForgeGradle 2.3's ancient ASM can't read during reobfuscation - and they aren't used
// on the 1.12.2 (LaunchWrapper / Java 8) runtime, so strip them out.
from(configurations.embed.collect { it.isDirectory() ? it : zipTree(it) }) {
exclude 'module-info.class'
exclude 'META-INF/versions/**'
exclude 'org/spongepowered/asm/launch/MixinLaunchPlugin*'
exclude 'org/spongepowered/asm/launch/MixinTransformationService*'
exclude 'org/spongepowered/asm/launch/platform/container/ContainerHandleModLauncher*'
exclude 'org/spongepowered/asm/service/modlauncher/**'
exclude 'LICENSE.txt', 'NOTICE.txt'
}
manifest {
attributes(
'FMLCorePlugin': 'fudge.notenoughcrashes.coremod.NecCoreMod',
'FMLCorePluginContainsFMLMod': 'true',
'ForceLoadAsMod': 'true',
'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker',
'TweakOrder': '0',
'MixinConfigs': 'mixins.notenoughcrashes.json'
)
}
// Avoid duplicate META-INF service files etc. coming from the shaded library.
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}