Skip to content

Commit

Permalink
Update to Minecraft 1.20.6, closes #19
Browse files Browse the repository at this point in the history
  • Loading branch information
TheIllusiveC4 committed May 11, 2024
1 parent 59eaa90 commit 364c8cd
Show file tree
Hide file tree
Showing 37 changed files with 447 additions and 637 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/BUG-REPORT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ body:
label: Minecraft Version
description: What version of Minecraft are you running? (Unlisted versions are unsupported)
options:
- 1.20.6
- 1.20.4
- 1.20.1
- 1.19.2
- 1.18.2
validations:
required: true
- type: textarea
Expand Down
107 changes: 6 additions & 101 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,101 +6,6 @@ plugins {
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7"
}

subprojects {
apply plugin: 'java'

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

jar {
from(rootProject.file("LICENSE"))
from(rootProject.file("COPYING"))
from(rootProject.file("COPYING.LESSER"))
from(rootProject.file("README.md"))
from(rootProject.file("CHANGELOG.md"))
manifest {
attributes([
'Specification-Title' : mod_name,
'Specification-Vendor' : mod_author,
'Specification-Version' : project.jar.archiveVersion,
'Implementation-Title' : project.name,
'Implementation-Version' : project.jar.archiveVersion,
'Implementation-Vendor' : mod_author,
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
'Timestamp' : System.currentTimeMillis(),
'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})",
'Built-On-Minecraft' : minecraft_version
])
}
}

sourcesJar {
from(rootProject.file("LICENSE"))
from(rootProject.file("COPYING"))
from(rootProject.file("COPYING.LESSER"))
from(rootProject.file("README.md"))
from(rootProject.file("CHANGELOG.md"))
}

repositories {
mavenCentral()
maven {
name = 'Sponge / Mixin'
url = 'https://repo.spongepowered.org/repository/maven-public/'
}
maven {
name = 'BlameJared Maven (JEI / CraftTweaker / Bookshelf)'
url = 'https://maven.blamejared.com'
}
}

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

processResources {
def expandProps = [
"version" : version,
"group" : project.group, //Else we target the task's group.
"minecraft_version" : minecraft_version,
"forge_version" : forge_version,
"forge_loader_version_range" : forge_loader_version_range,
"forge_version_range" : forge_version_range,
"minecraft_version_range" : minecraft_version_range,
"minecraft_version_range_alt" : minecraft_version_range_alt,
"fabric_version" : fabric_version,
"fabric_loader_version" : fabric_loader_version,
"mod_name" : mod_name,
"mod_author" : mod_author,
"mod_id" : mod_id,
"license" : license,
"issues_url" : issues_url,
"sources_url" : sources_url,
"description" : project.description,
"neoforge_version" : neoforge_version,
"neoforge_loader_version_range": neoforge_loader_version_range
]

filesMatching(['pack.mcmeta', 'fabric.mod.json', 'META-INF/mods.toml', '*.mixins.json']) {
expand expandProps
}
inputs.properties(expandProps)
}

// Disables Gradle's custom module metadata from being published to maven. The
// metadata includes mapped dependencies which are not reasonably consumable by
// other mod developers.
tasks.withType(GenerateModuleMetadata).configureEach {
enabled = false
}

tasks.withType(Jar).all {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
}

def publishDiscord() {
try {
def cfLinks = new StringJoiner('\\n')
Expand Down Expand Up @@ -136,7 +41,7 @@ def publishDiscord() {
changelog = changelog.replaceAll("\n", "\\\\n")

if (changelog.length() >= 1024) {
changelog = changelog.substring(0, changelog.length() - 100)
changelog = changelog.substring(0, 924)
changelog = changelog + "...[(See more)](${changelog_link})"
}
println(changelog)
Expand Down Expand Up @@ -181,7 +86,7 @@ def publishDiscord() {
}
"""
println(message)
final URL url = new URL("${discordWebhook}")
final URL url = URI.create("${discordWebhook}").toURL()
final HttpsURLConnection connection = (HttpsURLConnection) url.openConnection()
connection.addRequestProperty("Content-Type", "application/json; charset=UTF-8")
connection.addRequestProperty("User-Agent", "${mod_name} Gradle Upload")
Expand Down Expand Up @@ -239,16 +144,16 @@ tasks.register('publishFabricForge') {
}
}

tasks.register('publishForgeNeoForge') {
dependsOn ordered(':forge:modrinth', ':forge:publishCurseForge', ':neoforge:modrinth', ':neoforge:publishCurseForge')
tasks.register('publishFabricNeoForge') {
dependsOn ordered(':fabric:modrinth', ':fabric:publishCurseForge', ':neoforge:modrinth', ':neoforge:publishCurseForge')

doLast {
publishDiscord()
}
}

tasks.register('publishFabricNeoForge') {
dependsOn ordered(':fabric:modrinth', ':fabric:publishCurseForge', ':neoforge:modrinth', ':neoforge:publishCurseForge')
tasks.register('publishForgeNeoForge') {
dependsOn ordered(':forge:modrinth', ':forge:publishCurseForge', ':neoforge:modrinth', ':neoforge:publishCurseForge')

doLast {
publishDiscord()
Expand Down
3 changes: 3 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
plugins {
id 'groovy-gradle-plugin'
}
123 changes: 123 additions & 0 deletions buildSrc/src/main/groovy/multiloader-common.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
plugins {
id 'java-library'
id 'maven-publish'
}

base {
archivesName = "${mod_id}-${project.name}"
}

java {
toolchain.languageVersion = JavaLanguageVersion.of(java_version)
withSourcesJar()
withJavadocJar()
}

repositories {
mavenCentral()
// https://docs.gradle.org/current/userguide/declaring_repositories.html#declaring_content_exclusively_found_in_one_repository
exclusiveContent {
forRepository {
maven {
name = 'Sponge'
url = 'https://repo.spongepowered.org/repository/maven-public'
}
}
filter { includeGroupAndSubgroups("org.spongepowered") }
}
maven {
name = 'Illusive Soulworks'
url = 'https://maven.theillusivec4.top'
}
maven {
name = 'ParchmentMC'
url = 'https://maven.parchmentmc.org'
}
}

dependencies {
implementation 'org.jetbrains:annotations:24.1.0'
}

// Declare capabilities on the outgoing configurations.
// Read more about capabilities here: https://docs.gradle.org/current/userguide/component_capabilities.html#sec:declaring-additional-capabilities-for-a-local-component
['apiElements', 'runtimeElements', 'sourcesElements', 'javadocElements'].each { variant ->
configurations."$variant".outgoing {
capability("$group:$mod_id-${project.name}-${minecraft_version}:$version")
capability("$group:$mod_id:$version")
}
publishing.publications.configureEach {
suppressPomMetadataWarningsFor(variant)
}
}

sourcesJar {
from(rootProject.file("LICENSE"))
from(rootProject.file("COPYING"))
from(rootProject.file("COPYING.LESSER"))
from(rootProject.file("README.md"))
from(rootProject.file("CHANGELOG.md"))
}

jar {
from(rootProject.file("LICENSE"))
from(rootProject.file("COPYING"))
from(rootProject.file("COPYING.LESSER"))
from(rootProject.file("README.md"))
from(rootProject.file("CHANGELOG.md"))

manifest {
attributes([
'Specification-Title' : mod_name,
'Specification-Vendor' : mod_author,
'Specification-Version' : project.jar.archiveVersion,
'Implementation-Title' : project.name,
'Implementation-Version': project.jar.archiveVersion,
'Implementation-Vendor' : mod_author,
'Built-On-Minecraft' : minecraft_version
])
}
}

processResources {
def expandProps = [
"version" : version,
"group" : project.group, //Else we target the task's group.
"minecraft_version" : minecraft_version,
"forge_version" : forge_version,
"forge_version_range" : forge_version_range,
"minecraft_version_range" : minecraft_version_range,
"minecraft_version_range_alt": minecraft_version_range_alt,
"fabric_version" : fabric_version,
"fabric_loader_version" : fabric_loader_version,
"mod_name" : mod_name,
"mod_author" : mod_author,
"mod_id" : mod_id,
"license" : license,
"issues_url" : issues_url,
"sources_url" : sources_url,
"description" : project.description,
"neoforge_version" : neoforge_version,
"neoforge_version_range" : neoforge_version_range,
"java_version" : java_version
]

filesMatching(['pack.mcmeta', 'fabric.mod.json', 'META-INF/mods.toml', 'META-INF/neoforge.mods.toml', '*.mixins.json']) {
expand expandProps
}
inputs.properties(expandProps)
}

publishing {
publications {
register('mavenJava', MavenPublication) {
artifactId base.archivesName.get()
from components.java
}
}
repositories {
maven {
url System.getenv("local_maven_url")
}
}
}
44 changes: 44 additions & 0 deletions buildSrc/src/main/groovy/multiloader-loader.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
plugins {
id 'multiloader-common'
}

configurations {
commonJava{
canBeResolved = true
}
commonResources{
canBeResolved = true
}
}

dependencies {
compileOnly(project(':common')) {
capabilities {
requireCapability "$group:$mod_id"
}
}
commonJava project(path: ':common', configuration: 'commonJava')
commonResources project(path: ':common', configuration: 'commonResources')
}

tasks.named('compileJava', JavaCompile) {
dependsOn(configurations.commonJava)
source(configurations.commonJava)
}

processResources {
dependsOn(configurations.commonResources)
from(configurations.commonResources)
}

tasks.named('javadoc', Javadoc).configure {
dependsOn(configurations.commonJava)
source(configurations.commonJava)
}

tasks.named("sourcesJar", Jar) {
dependsOn(configurations.commonJava)
from(configurations.commonJava)
dependsOn(configurations.commonResources)
from(configurations.commonResources)
}
Loading

0 comments on commit 364c8cd

Please sign in to comment.