Fixed AT not being declared in manifest + fix build.gradle tab/space mix

This commit is contained in:
Rongmario 2022-09-05 15:04:02 +01:00
parent 58795fb003
commit d282ef9b6b
2 changed files with 51 additions and 42 deletions

View file

@ -1,25 +1,25 @@
buildscript { buildscript {
repositories { repositories {
maven { maven {
// url = 'https://maven.cleanroommc.com' // url = 'https://maven.cleanroommc.com'
url = 'https://maven.minecraftforge.net' url = 'https://maven.minecraftforge.net'
} }
maven { maven {
url = 'https://repo.spongepowered.org/maven' url = 'https://repo.spongepowered.org/maven'
} }
} }
dependencies { dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3.4' classpath 'net.minecraftforge.gradle:ForgeGradle:2.3.4'
if (project.use_mixins.toBoolean()) { if (project.use_mixins.toBoolean()) {
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT' classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
} }
} }
} }
apply plugin: 'net.minecraftforge.gradle.forge' apply plugin: 'net.minecraftforge.gradle.forge'
if (project.use_mixins.toBoolean()) { if (project.use_mixins.toBoolean()) {
apply plugin: 'org.spongepowered.mixin' apply plugin: 'org.spongepowered.mixin'
} }
version = project.mod_version version = project.mod_version
@ -41,23 +41,23 @@ minecraft {
version = '1.12.2-14.23.5.2847' version = '1.12.2-14.23.5.2847'
runDir = 'run' runDir = 'run'
mappings = 'stable_39' mappings = 'stable_39'
def args = [] def args = []
if (project.use_coremod.toBoolean()) { if (project.use_coremod.toBoolean()) {
args << '-Dfml.coreMods.load=' + coremod_plugin_class_name args << '-Dfml.coreMods.load=' + coremod_plugin_class_name
} }
if (project.use_mixins.toBoolean()) { if (project.use_mixins.toBoolean()) {
args << '-Dmixin.hotSwap=true' args << '-Dmixin.hotSwap=true'
args << '-Dmixin.checks.interfaces=true' args << '-Dmixin.checks.interfaces=true'
args << '-Dmixin.debug.export=true' args << '-Dmixin.debug.export=true'
} }
clientJvmArgs.addAll(args) clientJvmArgs.addAll(args)
serverJvmArgs.addAll(args) serverJvmArgs.addAll(args)
} }
repositories { repositories {
maven { maven {
url = 'https://maven.cleanroommc.com' url = 'https://maven.cleanroommc.com'
} }
maven { maven {
url = 'https://repo.spongepowered.org/maven' url = 'https://repo.spongepowered.org/maven'
} }
@ -65,13 +65,13 @@ repositories {
dependencies { dependencies {
if (project.use_assetmover.toBoolean()) { if (project.use_assetmover.toBoolean()) {
deobfCompile 'com.cleanroommc:assetmover:0.2' deobfCompile 'com.cleanroommc:assetmover:0.2'
}
if (project.use_mixins.toBoolean()) {
deobfCompile 'zone.rong:mixinbooter:5.0'
} }
if (project.use_mixins.toBoolean()) {
deobfCompile 'zone.rong:mixinbooter:5.0'
}
} }
sourceSets { sourceSets {
@ -96,22 +96,28 @@ processResources {
from(sourceSets.main.resources.srcDirs) { from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info' exclude 'mcmod.info'
} }
rename '(.+_at.cfg)', 'META-INF/$1' // Access Transformers
if (project.use_access_transformer.toBoolean()) {
rename '(.+_at.cfg)', 'META-INF/$1' // Access Transformers
}
} }
jar { jar {
manifest { manifest {
def attribute_map = [:] def attribute_map = [:]
if (project.use_coremod.toBoolean()) { if (project.use_coremod.toBoolean()) {
attribute_map['FMLCorePlugin'] = project.coremod_plugin_class_name attribute_map['FMLCorePlugin'] = project.coremod_plugin_class_name
if (project.include_mod.toBoolean()) { if (project.include_mod.toBoolean()) {
attribute_map['FMLCorePluginContainsFMLMod'] = true attribute_map['FMLCorePluginContainsFMLMod'] = true
attribute_map['ForceLoadAsMod'] = project.gradle.startParameter.taskNames[0] == "build" attribute_map['ForceLoadAsMod'] = project.gradle.startParameter.taskNames[0] == "build"
} }
} }
if (project.use_mixins.toBoolean()) { if (project.use_mixins.toBoolean()) {
attribute_map['TweakClass'] = 'org.spongepowered.asm.launch.MixinTweaker' attribute_map['TweakClass'] = 'org.spongepowered.asm.launch.MixinTweaker'
} }
if (project.use_access_transformer.toBoolean()) {
attribute_map['FMLAT'] = project.archives_base_name + '_at.cfg'
}
attributes(attribute_map) attributes(attribute_map)
} }
} }

View file

@ -14,6 +14,9 @@ use_mixins = false
use_coremod = false use_coremod = false
use_assetmover = false use_assetmover = false
# Access Transformer files should be in the root of `resources` folder and with the filename formatted as: `{archives_base_name}_at.cfg`
use_access_transformer = false
# Coremod Arguments # Coremod Arguments
include_mod = true include_mod = true
coremod_plugin_class_name = coremod_plugin_class_name =