Jump to content

modid.refmap.json file is not being added, How Do I Solve It?


LakshyaK2011

Recommended Posts

I Was Making A Mod With Mixin, But When I Build, Refmap File Is Not Being Added In Jar File,

I Have Done All Things To Get It Work, I Also Have Configured The Gradle File To Make It Work, Still It Dosent Adds Refmap File,

In Dev Enviroment I Know There Will Be No Error, But In Real Game It Will Cause Error,

Here's My Gradle File, If Someone Found Any Problem, Please Let Me Know,

Thanks,

buildscript {
    repositories {
        maven { url = 'https://maven.minecraftforge.net' }
        maven { url = "https://repo.spongepowered.org/maven"}
        mavenCentral()
    }
    dependencies {
        classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
        classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
    }
}
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
plugins {
    id 'eclipse'
    id 'maven-publish'
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin:'org.spongepowered.mixin'

version = '1.18.2_1.0.3'
group = 'net.chauhanDevs.advance_modder'
archivesBaseName = 'plr_anim'

java.toolchain.languageVersion = JavaLanguageVersion.of(17)

sourceSets.main.resources { srcDir 'src/generated/resources' }

println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
minecraft {
    mappings channel: 'official', version: '1.18.2'

    // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default.

    runs {
        client {
            workingDirectory project.file('run')

            property 'mixin.env.disableRefMap', 'true'

            property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"

            property 'forge.logging.markers', 'REGISTRIES'

            property 'forge.logging.console.level', 'debug'

            property 'forge.enabledGameTestNamespaces', 'plr_anim'

            arg "-mixin.config=plr_anim.mixins.json"

            mods {
                plr_anim {
                    source sourceSets.main
                }
            }
        }

        server {
            workingDirectory project.file('run')

            property 'mixin.env.disableRefMap', 'true'

            property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"

            property 'forge.logging.markers', 'REGISTRIES'

            property 'forge.logging.console.level', 'debug'

            property 'forge.enabledGameTestNamespaces', 'plr_anim'

            arg "-mixin.config=plr_anim.mixins.json"

            mods {
                plr_anim {
                    source sourceSets.main
                }
            }
        }

        gameTestServer {
            workingDirectory project.file('run')

            property 'mixin.env.disableRefMap', 'true'

            property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"

            property 'forge.logging.markers', 'REGISTRIES'

            property 'forge.logging.console.level', 'debug'

            property 'forge.enabledGameTestNamespaces', 'plr_anim'

            arg "-mixin.config=plr_anim.mixins.json"

            mods {
                plr_anim {
                    source sourceSets.main
                }
            }
        }

        data {
            workingDirectory project.file('run')

            property 'mixin.env.disableRefMap', 'true'

            property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"

            property 'forge.logging.markers', 'REGISTRIES'

            property 'forge.logging.console.level', 'debug'

            args '--mod', 'plr_anim', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/'), "-mixin.config=plr_anim.mixins.json"

            mods {
                plr_anim {
                    source sourceSets.main
                }
            }
        }
    }
}

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

repositories {

}

dependencies {
    minecraft 'net.minecraftforge:forge:1.18.2-40.2.0'
}

mixin {
    add sourceSets.main, "plr_anim.refmap.json"
}

// Example for how to get properties into the manifest for reading at runtime.
jar {
    manifest {
        attributes([
                "Specification-Title"     : "Test Mod",
                "Specification-Vendor"    : "LakshyaK2011",
                "Specification-Version"   : "1", // We are version 1 of ourselves
                "Implementation-Title"    : "Test Mod",
                "Implementation-Version"  : project.jar.archiveVersion,
                "Implementation-Vendor"   : "LakshyaK2011",
                "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
                "MixinConfigs" : "plr_anim.mixins.json"
        ])
    }
}

// Example configuration to allow publishing using the maven-publish plugin
// This is the preferred method to reobfuscate your jar file
jar.finalizedBy('reobfJar')
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
// publish.dependsOn('reobfJar')

publishing {
    publications {
        mavenJava(MavenPublication) {
            artifact jar
        }
    }
    repositories {
        maven {
            url "file://${project.projectDir}/mcmodsrepo"
        }
    }
}

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

 

Edited by LakshyaK2011
Link to comment
Share on other sites

  • 6 months later...

I know I'm a few months late, but adding the line

annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'

to your dependencies should help fix this.

so it should look like this:

dependencies {
    minecraft 'net.minecraftforge:forge:1.18.2-40.2.0'
    annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.