Skip to content

Commit

Permalink
wip: moving stuff to 1.21.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sekwah41 committed Dec 23, 2024
1 parent 6afcf2c commit 28c7885
Show file tree
Hide file tree
Showing 12 changed files with 256 additions and 173 deletions.
216 changes: 107 additions & 109 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ buildscript {
}
dependencies {
classpath(group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '6.0.+', changing: true)
//classpath "org.spongepowered:mixingradle:0.7+"
classpath "org.apache.httpcomponents:httpmime:4.5.14"
classpath "org.parchmentmc:librarian:1.+"
}
}
plugins {
id "com.modrinth.minotaur" version "2.+"
id "com.matthewprenger.cursegradle" version "1.4.0"
id 'net.neoforged.moddev' version '1.0.21'
}

apply plugin: 'net.minecraftforge.gradle'
apply plugin: "java"
apply plugin: 'eclipse'
apply plugin: 'org.parchmentmc.librarian.forgegradle'
apply plugin: 'maven-publish'

//apply plugin: "org.spongepowered.mixin"
tasks.named('wrapper', Wrapper).configure {
distributionType = Wrapper.DistributionType.BIN
}

def branch = System.getenv("GITHUB_REF")
def snapshotName = null;
Expand All @@ -53,13 +53,13 @@ def versionString = (file('./version.txt').text + (isRelease ? "" : "-${snapshot
setVersion(versionString)
println "Version: ${getVersion()}"

group = project.package // http://maven.apache.org/guides/mini/guide-naming-conventions.html
group = project.package
archivesBaseName = project.archive

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

repositories {
// maven { url = "https://maven.sekwah.com" }
mavenLocal()
maven {
url "https://www.cursemaven.com"
content {
Expand All @@ -68,147 +68,135 @@ repositories {
}
}

base {
archivesName = mod_id
}

println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
minecraft {
// The mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD Snapshot are built nightly.
// stable_# Stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'official', version: '1.20.1'
//mappings channel: 'parchment', version: '2021.12.19-1.18.1'
//mappings channel: 'parchment', version: '2021.07.21-1.17'

// This is for personal local tests i was doing ignore it ;)
//mappings channel: 'snapshot', version: '20200706-unofficialtest-1.16.1'
neoForge {
// Specify the version of NeoForge to use.
version = project.neo_version

// Readd if access transformers needed
//accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
parchment {
mappingsVersion = project.parchment_mappings_version
minecraftVersion = project.parchment_minecraft_version
}

// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
// This line is optional. Access Transformers are automatically detected
//accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')

// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
client {
workingDirectory project.file('run')

// Recommended logging data for a userdev environment
//property 'forge.logging.markers', 'SCAN,REGISTR
//version=1.2.1ES,REGISTRYDUMP'

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

//property 'mixin.env.remapRefMap', 'true'
//property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"

mods {
"${project.modid}" {
source sourceSets.main
}
}
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}

server {
workingDirectory project.file('run')

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

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
server()
programArgument '--nogui'
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}

mods {
"${project.modid}" {
source sourceSets.main
}
}
// This run config launches GameTestServer and runs all registered gametests, then exits.
// By default, the server will crash when no gametests are provided.
// The gametest system is also enabled by default for other run configs under the /test command.
gameTestServer {
type = "gameTestServer"
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}

data {
workingDirectory project.file('run')
data()

// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
// gameDirectory = project.file('run-data')

// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}

// applies to all the run configs above
configureEach {
// Recommended logging data for a userdev environment
property 'forge.logging.markers', ''
//property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// The markers can be added/remove as needed separated by commas.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
systemProperty 'forge.logging.markers', 'REGISTRIES'

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

args '--mod', project.modid, '--all', '--output', file('src/generated/resources/')
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
logLevel = org.slf4j.event.Level.DEBUG
}
}

mods {
"${project.modid}" {
source sourceSets.main
}
}
mods {
// define mod <-> source bindings
// these are used to tell the game which sources are for which mod
// mostly optional in a single mod project
// but multi mod projects should define one per mod
"${mod_id}" {
sourceSet(sourceSets.main)
}
}
}

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

dependencies {
// Example mod dependency with JEI
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
// compileOnly "mezz.jei:jei-${mc_version}-common-api:${jei_version}"
// compileOnly "mezz.jei:jei-${mc_version}-forge-api:${jei_version}"
// runtimeOnly "mezz.jei:jei-${mc_version}-forge:${jei_version}"

// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.20-46.0.14'

//implementation 'org.spongepowered:mixin:0.8.5'
//annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
// Example mod dependency using a mod jar from ./libs with a flat dir repository
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
// The group id is ignored when searching -- in this case, it is "blank"
// implementation "blank:coolmod-${mc_version}:${coolmod_version}"

//compile "com.sekwah:SekCLib:${sekclib_version}:deobf"
// Trick intellij to allow for better editing in here for the discord task
// compile "org.apache.httpcomponents:httpmime:4.5.13"
//implementation fg.deobf("curse.maven:torohealth-damage-indicators-245733:3556931")
// Example mod dependency using a file as dependency
// implementation files("libs/coolmod-${mc_version}-${coolmod_version}.jar")

//implementation fg.deobf("curse.maven:hwyla:${project.hwyla_fileid}")
// Example project dependency using a sister or child project:
// implementation project(":myproject")

//include('org.ow2.asm:asm-debug-all:5.2')

// You may put jars on which you depend on in ./libs or you may define them like so..
// compile "some.group:artifact:version:classifier"
// compile "some.group:artifact:version"

// Real examples
// compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
// compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env

// For more info...
// For more info:
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html

}

// Readd if mixins start being used
//mixin {
// add sourceSets.main, "mixins.${project.modid}.refmap.json"
//
// debug.verbose = true
// debug.export = true
//}

// Example for how to get properties into the manifest for reading by the runtime..
jar {
finalizedBy 'reobfJar'
archiveClassifier = 'universal'
archiveBaseName = "${archivesBaseName}${project.mc_version}"
manifest {
attributes([
"Specification-Title": project.modid,
"Specification-Vendor": project.vendor,
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": "${versionString}",
"Implementation-Vendor" :project.vendor,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
])
}
var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
var replaceProperties = [minecraft_version : minecraft_version,
minecraft_version_range: minecraft_version_range,
neo_version : neo_version,
neo_version_range : neo_version_range,
loader_version_range : loader_version_range,
mod_id : mod_id,
mod_name : title,
mod_license : mod_license,
mod_version : getVersion(),
mod_authors : mod_authors,
mod_description : mod_description]
inputs.properties replaceProperties
expand replaceProperties
from "src/main/templates"
into "build/generated/sources/modMetadata"
}


// Include the output of "generateModMetadata" as an input directory for the build
// this works with both building through Gradle and the IDE.
sourceSets.main.resources.srcDir generateModMetadata
// To avoid having to run "generateModMetadata" manually, make it run on every project reload
neoForge.ideSyncTask generateModMetadata

// Example configuration to allow publishing using the maven-publish task
// we define a custom artifact that is sourced from the reobfJar output task
// and then declare that to be published
Expand Down Expand Up @@ -336,3 +324,13 @@ modrinth {
gameVersions = ["1.20", "1.20.1"]
changelog = getReleaseChangelog()
}


// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}

20 changes: 17 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,29 @@
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
org.gradle.debug=false

parchment_minecraft_version=1.21.3
parchment_mappings_version=2024.12.07

minecraft_version=1.21.3
minecraft_version_range=[1.21.3,1.22)
neo_version=21.3.58
neo_version_range=[21.4.38-beta,)
loader_version_range=[4,)

title=SekCLib
archive=SekCLib
# This is just for the jar outputs
mc_version=-1.20
modid=sekclib
mc_version=-1.21.3
mod_id=sekclib
package=com.sekwah
vendor=Sekwah
mod_authors=Sekwah
mod_description=A library mod which adds a few useful classes and utilities for modding.

mod_license=MIT

github=https://github.com/sekwah41/SekCLib
curse_project_id=371078
modrinth_slug=sekclib

4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
10 changes: 4 additions & 6 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
maven {
name = 'MinecraftForge'
url = 'https://maven.minecraftforge.net/'
}
maven { url = 'https://maven.neoforged.net/releases' }
}
}

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
}
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
}
Loading

0 comments on commit 28c7885

Please sign in to comment.