Подружить IDEA с Mixins

Версия Minecraft
1.12.2
API
Forge
1,308
83
556
Приветствую! Я только начинаю осваивать работу с миксинами. Подключил к проекту согласно гайду, найденному на просторах форума. Вроде бы всё работает, однако перестаёт запускаться игра из среды разработки - встроенный компилятор выдаёт ошибку. Как вы решали данную проблему?

build.png

Настройки проекта:
settings.png

build.gradle:
plugins {
    id 'net.minecraftforge.gradle' version '6.0.+'
    id 'org.spongepowered.mixin' version '0.7-SNAPSHOT'
    id 'idea'
}

repositories {
    mavenLocal()
    mavenCentral()
    maven {
        name = 'sponge'
        url = 'https://repo.spongepowered.org/maven'
    }
    maven {
        // Su5ed LegacyDev Fork
        url = "https://maven.su5ed.dev/releases"
    }
}

java {
    toolchain.languageVersion = JavaLanguageVersion.of(8)
    sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
}

legacy {
    fixClasspath = true
    extractMappings = true
    attachMappings = true
}

idea {
    module {
        inheritOutputDirs = true
        excludeDirs += file('run')
    }
}

minecraft {
    mappings channel: 'stable', version: '39-1.12'
    accessTransformer = file('src/main/resources/META-INF/modid_at.cfg')

    runs {
        configureEach {
            workingDirectory file('run')

            property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
            property 'forge.logging.console.level', 'debug'
            environment 'MC_VERSION', '1.12.2'
            args '--tweakClass', 'org.spongepowered.asm.launch.MixinTweaker', '--mixin', 'mixins.modid.json'

            mods {
                "${mod_id}" {
                    source sourceSets.main
                }
            }
        }

        client {}
        server {}
    }
}

mixin {
    add sourceSets.main, 'mixins.modid.refmap.json'
}

sourceSets {
    main {
        // Include resources generated by data generators
        resources { srcDir 'src/generated/resources' }
    }
}

dependencies {
    minecraft 'net.minecraftforge:forge:1.12.2-14.23.5.2860'
    implementation 'org.spongepowered:mixin:0.8.3-SNAPSHOT'
    annotationProcessor 'org.spongepowered:mixin:0.8.3-SNAPSHOT:processor'

    constraints {
        implementation('net.minecraftforge:legacydev:0.3.0.0-legacyExt') {
            because 'Needed to have all ATs work properly'
        }

        implementation('org.ow2.asm:asm-debug-all:5.2') {
            because 'Newer ASM versions include module info that causes errors in Java 8'
        }
    }

    configurations.forEach {
        // MergeTool pollutes the classpath with conflicting classes
        it.exclude(group: 'net.minecraftforge', module: 'mergetool')

        // LegacyDev forge dep wants fatjar as the classifier, but 3.0 lacks it
        it.resolutionStrategy.eachDependency {
            if (it.requested.module.toString() == "net.minecraftforge:legacydev") {
                it.artifactSelection {
                    it.selectArtifact(DependencyArtifact.DEFAULT_TYPE, null, null)
                }
            }
        }
    }
}

tasks.withType(JavaCompile).configureEach {
    options.encoding = 'UTF-8'
}

processResources {
    // redo task if any of these properties change
    inputs.property 'version', project.version
    duplicatesStrategy = DuplicatesStrategy.INCLUDE

    // Replace properties in all files
    from(sourceSets.main.resources.srcDirs) {
        include 'mcmod.info'
        expand 'version': project.version
    }
}

jar {
    manifest {
        attributes 'FMLCorePluginContainsFMLMod': 'true'
        attributes 'FMLAT': 'modid_at.cfg'
        attributes 'ForceLoadAsMod': 'true'
        attributes 'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker'
        attributes 'MixinConfigs': 'mixins.modid.json'
    }
}
 
Приветствую! Я только начинаю осваивать работу с миксинами. Подключил к проекту согласно гайду, найденному на просторах форума. Вроде бы всё работает, однако перестаёт запускаться игра из среды разработки - встроенный компилятор выдаёт ошибку. Как вы решали данную проблему?

Посмотреть вложение 18029

Настройки проекта:
Посмотреть вложение 18030

build.gradle:
plugins {
    id 'net.minecraftforge.gradle' version '6.0.+'
    id 'org.spongepowered.mixin' version '0.7-SNAPSHOT'
    id 'idea'
}

repositories {
    mavenLocal()
    mavenCentral()
    maven {
        name = 'sponge'
        url = 'https://repo.spongepowered.org/maven'
    }
    maven {
        // Su5ed LegacyDev Fork
        url = "https://maven.su5ed.dev/releases"
    }
}

java {
    toolchain.languageVersion = JavaLanguageVersion.of(8)
    sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
}

legacy {
    fixClasspath = true
    extractMappings = true
    attachMappings = true
}

idea {
    module {
        inheritOutputDirs = true
        excludeDirs += file('run')
    }
}

minecraft {
    mappings channel: 'stable', version: '39-1.12'
    accessTransformer = file('src/main/resources/META-INF/modid_at.cfg')

    runs {
        configureEach {
            workingDirectory file('run')

            property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
            property 'forge.logging.console.level', 'debug'
            environment 'MC_VERSION', '1.12.2'
            args '--tweakClass', 'org.spongepowered.asm.launch.MixinTweaker', '--mixin', 'mixins.modid.json'

            mods {
                "${mod_id}" {
                    source sourceSets.main
                }
            }
        }

        client {}
        server {}
    }
}

mixin {
    add sourceSets.main, 'mixins.modid.refmap.json'
}

sourceSets {
    main {
        // Include resources generated by data generators
        resources { srcDir 'src/generated/resources' }
    }
}

dependencies {
    minecraft 'net.minecraftforge:forge:1.12.2-14.23.5.2860'
    implementation 'org.spongepowered:mixin:0.8.3-SNAPSHOT'
    annotationProcessor 'org.spongepowered:mixin:0.8.3-SNAPSHOT:processor'

    constraints {
        implementation('net.minecraftforge:legacydev:0.3.0.0-legacyExt') {
            because 'Needed to have all ATs work properly'
        }

        implementation('org.ow2.asm:asm-debug-all:5.2') {
            because 'Newer ASM versions include module info that causes errors in Java 8'
        }
    }

    configurations.forEach {
        // MergeTool pollutes the classpath with conflicting classes
        it.exclude(group: 'net.minecraftforge', module: 'mergetool')

        // LegacyDev forge dep wants fatjar as the classifier, but 3.0 lacks it
        it.resolutionStrategy.eachDependency {
            if (it.requested.module.toString() == "net.minecraftforge:legacydev") {
                it.artifactSelection {
                    it.selectArtifact(DependencyArtifact.DEFAULT_TYPE, null, null)
                }
            }
        }
    }
}

tasks.withType(JavaCompile).configureEach {
    options.encoding = 'UTF-8'
}

processResources {
    // redo task if any of these properties change
    inputs.property 'version', project.version
    duplicatesStrategy = DuplicatesStrategy.INCLUDE

    // Replace properties in all files
    from(sourceSets.main.resources.srcDirs) {
        include 'mcmod.info'
        expand 'version': project.version
    }
}

jar {
    manifest {
        attributes 'FMLCorePluginContainsFMLMod': 'true'
        attributes 'FMLAT': 'modid_at.cfg'
        attributes 'ForceLoadAsMod': 'true'
        attributes 'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker'
        attributes 'MixinConfigs': 'mixins.modid.json'
    }
}
Покопайся в моих ответах, я кучу раз пересылал свой рабочий build.gradle в котором миксины работают (потом перешлю еще раз)
 
Рекомендую для проектов с миксинами юзать RetroFuturaGradle, там все заводится с полоборота
Скрипт сборки на 1.5K строк никак не вписывается в концепцию минимализма.

в котором миксины работают
Они как бы работают, спотыкается именно встроенный компилятор идеи на процессинге аннотаций.
 
Скрипт сборки на 1.5K строк никак не вписывается в концепцию минимализма.
Он и не пытается, этот скрипт решает любые возможные разумные задачи организации воркспейса мода. Там есть файл конфига, в нем настраиваешь параметры как нужно и оно работает.
Можно также взять один RetroFuturaGradle и настроить проект с нуля, но придется разбираться в этом плагине. Чтение этого 1.5к строк кст помогает в этом, потому что там использованы все фичи
 
Назад
Сверху