Update for mc1.21.1

This commit is contained in:
2025-04-30 20:44:45 +02:00
parent 6c2f7a47e2
commit d4ec55c0fa
45 changed files with 537 additions and 1081 deletions

View File

@@ -1,193 +1,182 @@
plugins {
id 'eclipse'
id 'idea'
id 'net.minecraftforge.gradle' version '[6.0.16,6.2)'
id 'maven-publish'
id "idea"
id "net.neoforged.moddev" version "2.0.74"
id "dev.ithundxr.silk" version "0.11.15"
id "me.modmuss50.mod-publish-plugin" version "0.8.3"
id "maven-publish"
}
apply from: "./gradle/java.gradle"
apply from: "gradle/property_loader.gradle"
group = "com.${author}.${modid}"
group = "com.${mod_author}.${mod_id}"
version = "${minecraft_version}-${mod_version}"
archivesBaseName = modid
archivesBaseName = mod_id
java {
toolchain.languageVersion = JavaLanguageVersion.of(17)
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
minecraft {
// The mappings can be changed at any time and must be in the following format.
// Channel: Version:
// official MCVersion Official field/method names from Mojang mapping files
// parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official
//
// You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
//
// Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
// Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started
//
// 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: mapping_channel, version: mapping_version
neoForge {
version = project.neo_version
// When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game.
// In most cases, it is not necessary to enable.
// enableEclipsePrepareRuns = true
// enableIdeaPrepareRuns = true
accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')
// This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game.
// It is REQUIRED to be set to true for this template to function.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
copyIdeResources = true
// When true, this property will add the folder name of all declared run configurations to generated IDE run configurations.
// The folder name can be set on a run configuration using the "folderName" property.
// By default, the folder name of a run configuration is the name of the Gradle project containing it.
// generateRunFolders = true
// This property enables access transformers for use in development.
// They will be applied to the Minecraft artifact.
// The access transformer file can be anywhere in the project.
// However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge.
// This default location is a best practice to automatically put the file in the right place in the final jar.
// See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information.
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
parchment {
minecraftVersion = project.parchment_minecraft_version
mappingsVersion = project.parchment_version
}
mods {
"$mod_id" {
sourceSet sourceSets.main
}
}
runs {
// applies to all the run configs below
configureEach {
workingDirectory project.file('run')
systemProperty 'forge.logging.markers', ''
systemProperty 'forge.logging.console.level', 'info'
jvmArguments = ["-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition"]
//jvmArgs("-XX:-OmitStackTraceInFastThrow") // uncomment when you get exceptions with null messages etc
//jvmArgs '-XX:+UnlockCommercialFeatures' // uncomment for profiling
// Recommended logging data for a userdev environment
// 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.
property 'forge.logging.markers', 'REGISTRIES'
systemProperty 'mixin.debug.export', 'true'
systemProperty 'mixin.debug.verbose', 'true'
programArgument '-mixin.config=create.mixins.json'
//programArgument '-mixin.config=ponder.mixins.json'
//systemProperty("mixin.env.remapRefMap", "true")
//systemProperty("mixin.env.refMapRemappingFile", "${projectDir}/build/createSrgToMcp/output.srg")
// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
property 'forge.logging.console.level', 'debug'
mods {
"${modid}" {
source sourceSets.main
}
}
}
client {
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', modid
client()
gameDirectory = project.file('run')
}
server {
property 'forge.enabledGameTestNamespaces', modid
args '--nogui'
}
server()
// 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 {
property 'forge.enabledGameTestNamespaces', modid
gameDirectory = project.file('run/server')
}
data {
// example of overriding the workingDirectory set in configureEach above
workingDirectory project.file('run-data')
data()
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', modid, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
gameDirectory = project.file('run')
systemProperty 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP'
systemProperty 'forge.logging.console.level', 'debug'
programArguments.addAll("--mod", mod_id as String, "--all", "--output", file("src/generated/resources/").getAbsolutePath(), "--existing", file("src/main/resources").getAbsolutePath())
}
gameTestServer {
type = "gameTestServer"
gameDirectory = project.file('run/gametest')
// setForceExit false <- FIXME 1.20
}
}
}
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
sourceSets.main {
resources {
srcDir 'src/generated/resources'
exclude '.cache/'
}
}
repositories {
maven {
// location of the maven for Registrate and Flywheel
name = 'tterrag maven'
url = 'https://maven.tterrag.com'
}
maven {
// location of the maven that hosts JEI files since January 2023
// location of the maven for Vazkii's mods
name = "Jared's maven"
url = "https://maven.blamejared.com/"
}
maven { url = "https://maven.createmod.net" } // Create, Ponder, Flywheel
maven { url = "https://raw.githubusercontent.com/Fuzss/modresources/main/maven/" } // ForgeConfigAPIPort
maven { url = "https://mvn.devos.one/snapshots" } // Registrate
maven { url = "https://maven.blamejared.com" } // JEI, Vazkii's Mods
maven {
// location of the maven for Curios API
url = "https://maven.theillusivec4.top/"
}
maven {
// location of maven for CC: Tweaked
name = "squiddev"
url = "https://squiddev.cc/maven/"
}
maven {
url = 'https://www.cursemaven.com'
content {
includeGroup "curse.maven"
}
}
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
maven {
url "https://jitpack.io"
content {
includeGroup "com.github.llamalad7.mixinextras"
}
}
maven {
url "https://maven.latvian.dev/releases"
content {
includeGroup "dev.latvian.mods"
includeGroup "dev.latvian.apps"
}
}
maven {
url "https://maven.architectury.dev/"
content {
includeGroup "dev.architectury"
}
}
mavenLocal()
flatDir {
dirs 'libs'
}
}
dependencies {
implementation 'org.jetbrains:annotations:22.0.0'
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
implementation("net.createmod.ponder:Ponder-NeoForge-${minecraft_version}:${ponder_version}")
compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}-common-api:${jei_version}")
/*compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}-common-api:${jei_version}")
compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}-forge-api:${jei_version}")
runtimeOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}-forge:${jei_version}")
*/
/*implementation fg.deobf("curse.maven:jade-324717:${jade_id}")*/
implementation fg.deobf("curse.maven:jade-324717:${jade_id}")
}
if (System.getProperty('idea.sync.active') != 'true') {
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
processResources {
def buildProps = project.properties.clone()
// Replaces FML's magic file.jarVersion string with the correct version at build time.
buildProps.put('file', [jarVersion: project.version])
filesMatching(['META-INF/neoforge.mods.toml', 'pack.mcmeta']) {
expand buildProps
}
}
// This block of code expands all declared replace properties in the specified resource targets.
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
tasks.named('processResources', ProcessResources).configure {
var replaceProperties = [minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range,
forge_version : forge_version, forge_version_range: forge_version_range,
loader_version_range: loader_version_range,
modid : modid, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
author : author, mod_description: mod_description,]
inputs.properties replaceProperties
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
expand replaceProperties + [project: project]
}
compileJava {
options.compilerArgs = ['-Xdiags:verbose']
}
// Example for how to get properties into the manifest for reading at runtime.
tasks.named('jar', Jar).configure {
manifest {
attributes(["Specification-Title" : modid,
"Specification-Vendor" : author,
"Specification-Version" : "1", // We are version 1 of ourselves
"Implementation-Title" : project.name,
"Implementation-Version" : project.jar.archiveVersion,
"Implementation-Vendor" : author,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")])
jar {
from('LICENSE') {
rename { "${it}_${archivesBaseName}" }
}
// This is the preferred method to reobfuscate your jar file
finalizedBy 'reobfJar'
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
publishing {
// other settings of publication
publications {