Jump to content

Recommended Posts

Posted

Hello,

I am trying to use Patchouli so I can make a book in my mod.

I copied the part I think I need from Botania's build-gradle.
https://github.com/VazkiiMods/Botania/blob/fb8d7db61c54930d29f4b22ab988a783d61c83da/Common/build.gradle
https://github.com/VazkiiMods/Botania/blob/4697930092cd1cc1ad318abc9ab7ebf58ee9b5ce/Forge/build.gradle

But the compilation fails with the following error:

Quote

A problem occurred evaluating root project 'test_mod'.
> Could not find method compileOnly() for arguments [vazkii.patchouli:Patchouli-xplat:1.18.2-66-SNAPSHOT] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Where does compileOnly() come from?

This is my build.gradle:

buildscript {
    repositories {
        maven { url = 'https://maven.minecraftforge.net' }

        maven {
            name = "Jared"
            url = "https://maven.blamejared.com/"
        }

        mavenCentral()
    }
    
    dependencies {
        classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true

        compileOnly "vazkii.patchouli:Patchouli-xplat:1.18.2-66-SNAPSHOT"
        implementation fg.deobf("vazkii.patchouli:Patchouli:1.18.2-66-SNAPSHOT")
    }
}

apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

version = '1.0'
group = 'com.ideki.test_mod'
archivesBaseName = 'test_mod'

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

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.1'

    accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
    
    runs {
        client {
            workingDirectory project.file('run')

            mods {
                test_mod {
                    source sourceSets.main
                }
            }
        }

        server {
            workingDirectory project.file('run')

            mods {
                test_mod {
                    source sourceSets.main
                }
            }
        }

        data {
            workingDirectory project.file('run')

            args '--mod', archivesBaseName, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')

            mods {
                test_mod {
                    source sourceSets.main
                }
            }
        }
    }
}

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

repositories {
}

dependencies {
    minecraft 'net.minecraftforge:forge:1.18.1-39.0.5'
}

jar {
    manifest {
        attributes([
                "Specification-Title"     : "test_mod",
                "Specification-Vendor"    : "Ideki",
                "Specification-Version"   : "1",
                "Implementation-Title"    : project.name,
                "Implementation-Version"  : project.jar.archiveVersion,
                "Implementation-Vendor"   : "Ideki",
                "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
        ])
    }
}

jar.finalizedBy('reobfJar')

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

Ok, so I fixed my build.gradle
Then I was able to compile.
But minecraft started I got an error message from Patchouli that basically said that I was not using the correct version of Forge.
So I changed the dependency to

Quote

minecraft 'net.minecraftforge:forge:1.18.1-39.1.0'

And I downloaded forge-1.18.1-39.1.0-mdk.zip

I extracted the files and copied gradlew, gradlew.bat and the gradle folder to my mod folder.

Now when I try to compile I get the following error:

Quote

Exception in thread "main" java.lang.IllegalStateException: Could not find forge-1.18.1-39.0.5 in classpath

So I am guessing I did something wrong when attempting to update the forge mdk.

Any idea what I am missing ?

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.