I am trying to port a 1.18.2 Minecraft mod to 1.19.2 but IntelliJ says "Could not resolve dependency: net.minecraftforge:forge:1.19.2:userdev"

86 views Asked by At

I was using this tutorial: "https://www.youtube.com/watch?v=du2gINiZzOc&t=1s" and was on the part called "Setting up in IntelliJ" I was just using Git Bash and Notepad as the text editor. My build gradle is this. As you can see there is no "net.minecraftforge:forge:1.19.2:userdev". I am a beginner at this so I have no experience whatsoever. Also the mod can be found here: https://github.com/KnightMiner/AnimalCrops

buildscript {
    repositories {
        maven { url = 'https://maven.minecraftforge.net' }
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
    }
}

apply plugin: 'net.minecraftforge.gradle'

group = "knightminer"
archivesBaseName = "AnimalCrops"
java.toolchain.languageVersion = JavaLanguageVersion.of(17)

configurations {
    deployerJars
}

version = "${minecraft_version}-${mod_version}"

sourceSets {
    main {
        resources {
            srcDirs "$rootDir/src/generated/resources"
            // Exclude the cache of the generated data from what gets built
            exclude '.cache'
        }
    }
}

minecraft {
    mappings channel: 'official', version: "1.19.2-46.0.1"
    accessTransformer project.file("src/main/resources/META-INF/accesstransformer.cfg")

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

            // Recommended logging data for a userdev environment
            property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'

            // Recommended logging level for the console
            property 'forge.logging.console.level', 'debug'

            mods {
                animalcrops {
                    source sourceSets.main
                }
            }
        }

        server {
            workingDirectory project.file('run')

            // Recommended logging data for a userdev environment
            property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'

            // Recommended logging level for the console
            property 'forge.logging.console.level', 'debug'

            mods {
                animalcrops {
                    source sourceSets.main
                }
            }
        }

        data {
            workingDirectory project.file('run')

            // Recommended logging data for a userdev environment
            property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'

            // Recommended logging level for the console
            property 'forge.logging.console.level', 'debug'

        // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
      args '--mod', 'animalcrops', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')

      mods {
        animalcrops {
          source sourceSets.main
        }
      }
    }
  }
}

repositories {
    // JEI
  maven {
    // location of the maven that hosts JEI files
    name = "Progwml6 maven"
    url = "https://dvs1.progwml6.com/files/maven"
  }
  maven {
    // location of a maven mirror for JEI files, as a fallback
    name = "ModMaven"
    url = "https://modmaven.k-4u.nl"
  }
}

dependencies {
  minecraft "net.minecraftforge:forge:1.19.2"
  // compile against the JEI API but do not include it at runtime
  compileOnly fg.deobf("mezz.jei:jei-${jei_version}:api")
  // at runtime, use the full JEI jars
  runtimeOnly fg.deobf("mezz.jei:jei-${jei_version}")
}

// process mods.toml to inject variables
def modsTomlSpec = copySpec{
  from(sourceSets.main.resources) {
    include 'META-INF/mods.toml'
    expand 'version': mod_version,
            'loader_range': loader_range,
            'minecraft_range': minecraft_range,
            'forge_range': forge_range
  }
}
// need to copy into each build directory, unfortunately does not seem easy to do this automatically
def buildPaths = [
        "$rootDir/out/production/resources", // IDEA
        "$rootDir/bin", // Eclipse
]

// task to add mods.toml to all relevant folders
task replaceResources {
  // copy for gradle
  copy {
    outputs.upToDateWhen { false }
    with modsTomlSpec
    into processResources.destinationDir
  }
  // copy for IDEs
  buildPaths.each { path ->
    if (new File(path).exists()) {
      copy {
        outputs.upToDateWhen { false }
        with modsTomlSpec
        into path
      }
    }
  }
}

processResources {
  exclude 'META-INF/mods.toml'
  finalizedBy replaceResources
}

jar {
  manifest {
    attributes([
      "Specification-Title": "Animal Crops",
      "Specification-Vendor": "KnightMiner",
      "Specification-Version": "1", // We are version 1 of ourselves
      "Implementation-Title": project.name,
      "Implementation-Version": "${version}",
      "Implementation-Vendor": "KnightMiner",
      "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
    ])
  }
}

// because the normal output has been made to be obfuscated
task sourcesJar(type: Jar) {
  from sourceSets.main.allJava
  classifier = 'sources'
}

artifacts {
  archives sourcesJar
}
0

There are 0 answers