diff --git a/.gitignore b/.gitignore
index 461017f..e23bd4c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,8 +11,7 @@ out
*.ipr
*.iws
*.iml
-.idea/*
-!.idea/scopes
+.idea
# gradle
build
diff --git a/.idea/scopes/Fabric_sources.xml b/.idea/scopes/Fabric_sources.xml
deleted file mode 100644
index 0448412..0000000
--- a/.idea/scopes/Fabric_sources.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/.idea/scopes/Forge_sources.xml b/.idea/scopes/Forge_sources.xml
deleted file mode 100644
index 7b5f24d..0000000
--- a/.idea/scopes/Forge_sources.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index de4668d..5f4b1dd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,7 +9,11 @@ and this project adheres to [Crystal Nest Semantic Versioning](https://crystalne
- Nothing new.
-## [7.0.0] - 2024/06/24
+## [v7.0.0] - 2024/07/10
+
+- Ported to 1.21.
+
+## [v7.0.0] - 2024/06/24
- Improve Soul Fire'd compatibility and update to v4.0.2.
- Upgrade to a multiloader environment and update standards.
@@ -195,7 +199,7 @@ and this project adheres to [Crystal Nest Semantic Versioning](https://crystalne
[Unreleased]: https://github.com/crystal-nest/torch-hit
[README]: https://github.com/crystal-nest/torch-hit#readme
-[7.0.0]: https://github.com/crystal-nest/torch-hit/releases?q=7.0.0
+[v7.0.0]: https://github.com/crystal-nest/torch-hit/releases?q=7.0.0
[1.20.4-6.0.2.0]: https://github.com/crystal-nest/torch-hit/releases/tag/v1.20.4-6.0.2.0
[1.20.2-6.0.2.0]: https://github.com/crystal-nest/torch-hit/releases/tag/v1.20.2-6.0.2.0
diff --git a/README.md b/README.md
index a64d7a7..d6ee695 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
![Torch hit! banner](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/torch-hit/banner.gif)
---
-![Minecraft](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/minecraft.svg)[![1.20.4](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-20-4.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.20.4)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.20.2](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/minecraft/1-20-2.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.20.2)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.20.1](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-20-1.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.20.1)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.19.4](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-19-4.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.19.4)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.19.2](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-19-2.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.19.2)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.18.2](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-18-2.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.18.2)
+![Minecraft](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/minecraft.svg)[![1.21](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-21.svg "1.21")](https://modrinth.com/mod/torch-hit/versions?g=1.21)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.20.4](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-20-4.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.20.4)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.20.2](https://raw.githubusercontent.com/Nyphet/mod-fancy-assets/main/minecraft/1-20-2.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.20.2)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.20.1](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-20-1.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.20.1)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.19.4](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-19-4.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.19.4)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.19.2](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-19-2.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.19.2)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![1.18.2](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/minecraft/1-18-2.svg)](https://modrinth.com/mod/torch-hit/versions?g=1.18.2)
![Loader](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/loader/loader.svg)[![NeoForge](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/loader/neoforge.svg)](https://modrinth.com/mod/torch-hit/versions?l=neoforge)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![Forge](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/loader/forge.svg)](https://modrinth.com/mod/torch-hit/versions?l=forge)![Separator](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/separator.svg)[![Fabric](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/loader/fabric.svg)](https://modrinth.com/mod/torch-hit/versions?l=fabric)
diff --git a/build.gradle b/build.gradle
index 2a7e899..006c00d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,13 +1,13 @@
plugins {
id "org.sonarqube" version "4.4.1.3373"
- id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7"
id "com.hypherionmc.modutils.modpublisher" version "2.1.4" apply false
- id "fabric-loom" version "1.5-SNAPSHOT" apply false
+ id "net.neoforged.moddev" version "0.1.110" apply false
+ id "fabric-loom" version "1.7-SNAPSHOT" apply false
}
sonar {
properties {
- property "sonar.projectKey", "Crystal-Nest_${mod_id_kebab}"
+ property "sonar.projectKey", "Crystal-Nest_$mod_id_kebab"
property "sonar.organization", "crystal-nest"
property "sonar.projectVersion", mod_version
property "sonar.host.url", "https://sonarcloud.io"
@@ -15,241 +15,6 @@ sonar {
}
}
-subprojects { subproject ->
- def noPublish = subproject.name === "common"
- def isFabric = subproject.name == "fabric"
-
- apply plugin: "java"
- apply plugin: "idea"
- apply plugin: "java-library"
- apply plugin: "com.hypherionmc.modutils.modpublisher"
- apply plugin: "maven-publish"
- if (isFabric) {
- apply plugin: "fabric-loom"
- }
-
- java.toolchain.languageVersion = JavaLanguageVersion.of(17)
- java.withSourcesJar()
- java.withJavadocJar()
-
- archivesBaseName = "${mod_id_kebab}-${subproject.name}"
- version = "${minecraft_version}-${mod_version}"
-
- jar {
- from(rootProject.file("LICENSE")) {
- rename { "${it}_${mod_title}" }
- }
- manifest {
- attributes([
- "Specification-Title" : mod_title,
- "Specification-Vendor" : mod_authors,
- "Specification-Version" : project.version,
- "Implementation-Title" : mod_title,
- "Implementation-Vendor" : mod_authors,
- "Implementation-Version" : project.version,
- "Implementation-URL" : "https://github.com/${github_user}/${mod_id_kebab}/tree/${minecraft_version}",
- "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")) {
- rename { "${it}_${mod_title}" }
- }
- }
-
- repositories {
- mavenCentral()
- maven {
- name = "Sponge / Mixin"
- url = "https://repo.spongepowered.org/repository/maven-public/"
- }
- maven {
- name = "Crystal Nest"
- url = "https://maven.crystalnest.it"
- }
- maven {
- name = "Fuzs Mod Resources"
- url = "https://raw.githubusercontent.com/Fuzss/modresources/main/maven/"
- }
- }
-
- tasks.withType(JavaCompile).configureEach {
- it.options.encoding = "UTF-8"
- it.options.getRelease().set(17)
- }
-
- processResources {
- def expandProps = [
- "mod_version" : mod_version,
- "group" : project.group,
- "mod_authors" : mod_authors,
- "mod_title" : mod_title,
- "mod_id" : mod_id,
- "mod_id_kebab" : mod_id_kebab,
- "license" : license,
- "description" : project.description,
- "credits" : credits,
- "github_user" : github_user,
- "curseforge_id" : curseforge_id,
- "minecraft_version" : minecraft_version,
- "minecraft_version_range" : minecraft_version_range,
- "fabric_version" : fabric_version,
- "fabric_loader_version" : fabric_loader_version,
- "forge_version" : forge_version,
- "forge_loader_version_range" : forge_loader_version_range,
- "neoforge_version" : neoforge_version,
- "neoforge_loader_version_range": neoforge_loader_version_range,
- "cobweb_version" : cobweb_version,
- "fcap_version" : fcap_version,
- "soul_fire_d_version" : soul_fire_d_version,
- ]
-
- filesMatching(["pack.mcmeta", "fabric.mod.json", "META-INF/mods.toml", "*.mixins.json"]) {
- expand expandProps
- }
- inputs.properties(expandProps)
- }
-
- tasks.withType(GenerateModuleMetadata).configureEach {
- enabled = false
- }
-
- def changelog_body = "See [Changelog](https://github.com/${github_user}/${mod_id_kebab}/blob/master/CHANGELOG.md#v${mod_version.replaceAll('\\.', '')}---${new Date().format("yyyyMMdd")})."
- def version_type = mod_version.replaceFirst("([0-9]+\\.?)+-?", "") ?: "release"
- def loader = "Common"
- switch (subproject.name) {
- case "fabric":
- loader = "Fabric"
- break
- case "forge":
- loader = "Forge"
- break
- case "neoforge":
- loader = "NeoForge"
- break
- }
-
- publishing {
- repositories {
- maven {
- name = "GitHubPackages"
- url = uri("https://maven.pkg.github.com/${github_user}/${mod_id_kebab}")
- credentials {
- username = github_user
- password = System.getenv("GITHUB_TOKEN") ?: ""
- }
- }
- }
- publications {
- gpr(MavenPublication) {
- groupId = project.group
- artifactId = "${mod_id_kebab}-${loader.toLowerCase()}"
- version = project.version
- from components.java
- pom {
- name = "[${loader} - ${minecraft_version}] ${mod_title} v${mod_version}"
- description = "${description}"
- url = "https://github.com/${github_user}/${mod_id_kebab}/tree/${minecraft_version}"
- issueManagement {
- system = "github"
- url = "https://github.com/${github_user}/${mod_id_kebab}/issues"
- }
- licenses {
- license {
- name = license
- url = "https://spdx.org/licenses/${license}.html"
- }
- }
- developers {
- mod_authors.split(", ").each { author ->
- developer {
- id = author.toLowerCase()
- name = author
- }
- }
- }
- }
- }
- }
- }
-
- publisher {
- apiKeys {
- github System.getenv("GITHUB_TOKEN") ?: ""
- modrinth System.getenv("MODRINTH_TOKEN") ?: ""
- curseforge System.getenv("CURSEFORGE_TOKEN") ?: ""
- }
- setDebug(noPublish)
- setVersion(mod_version)
- setChangelog(changelog_body)
- setVersionType(version_type)
- setArtifact(isFabric ? remapJar : jar)
- setDisableMalwareScanner(true) // Disable the built in Fractureizer scanner.
- setDisableEmptyJarCheck(true) // Disable check for valid mod metadata entry in artifact, which could possibly mean that the jar is empty.
- setModrinthID(mod_id_kebab)
- setCurseID(curseforge_id)
- if (!noPublish) {
- setLoaders(loader)
- }
- setGameVersions(minecraft_version)
- setDisplayName("[${loader} - ${minecraft_version}] ${mod_title} v${mod_version}")
- setJavaVersions([JavaVersion.VERSION_17])
- setCurseEnvironment("server") // "server", "client" or "both".
- github {
- repo = "${github_user}/${mod_id_kebab}"
- tag = "v${project.version}"
- displayName("v${project.version}")
- target = minecraft_version
- createTag = true
- createRelease = true
- updateRelease = true
- draft = false
- }
- modrinthDepends {
- required "cobweb"
- optional "soul-fire-d"
- switch (loader) {
- case "Fabric":
- required "fabric-api"
- required "forge-config-api-port"
- break
- case "Forge":
- required "forge-config-api-port"
- break
- case "NeoForge":
- break
- }
- }
- curseDepends {
- required "cobweb"
- optional "soul-fire-d"
- switch (loader) {
- case "Fabric":
- required "fabric-api"
- required "forge-config-api-port-fabric"
- break
- case "Forge":
- required "forge-config-api-port-fabric"
- break
- case "NeoForge":
- break
- }
- }
- }
-
- tasks.register("publishLoader") {
- group = "publishing"
- description = "Publish ${loader} specific versions to all platforms"
- dependsOn "publish"
- dependsOn "publishMod"
- }
-}
-
tasks.register("publishAll") {
group = "publishing"
description = "Publish all loader specific versions to all platforms"
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
new file mode 100644
index 0000000..0aa2ba4
--- /dev/null
+++ b/buildSrc/build.gradle
@@ -0,0 +1,3 @@
+plugins {
+ id "groovy-gradle-plugin"
+}
diff --git a/buildSrc/src/main/groovy/multiloader-common.gradle b/buildSrc/src/main/groovy/multiloader-common.gradle
new file mode 100644
index 0000000..0a55e83
--- /dev/null
+++ b/buildSrc/src/main/groovy/multiloader-common.gradle
@@ -0,0 +1,250 @@
+plugins {
+ id "java-library"
+ id "maven-publish"
+ id "com.hypherionmc.modutils.modpublisher"
+}
+
+base {
+ archivesName = "$mod_id_kebab-$name"
+ version = "$minecraft_version-$mod_version"
+}
+
+java {
+ toolchain.languageVersion = JavaLanguageVersion.of(java_version)
+ withSourcesJar()
+ withJavadocJar()
+}
+
+tasks.withType(JavaCompile).configureEach {
+ it.options.encoding = "UTF-8"
+ it.options.getRelease().set(java_version as Integer)
+}
+
+repositories {
+ mavenCentral()
+ exclusiveContent {
+ forRepository {
+ maven {
+ name = "Sponge"
+ url = "https://repo.spongepowered.org/repository/maven-public"
+ }
+ }
+ filter { includeGroupAndSubgroups("org.spongepowered") }
+ }
+ exclusiveContent {
+ forRepositories(
+ maven {
+ name = "ParchmentMC"
+ url = "https://maven.parchmentmc.org/"
+ },
+ maven {
+ name = "NeoForge"
+ url = "https://maven.neoforged.net/releases"
+ }
+ )
+ filter { includeGroup("org.parchmentmc.data") }
+ }
+ maven {
+ name = "Crystal Nest"
+ url = "https://maven.crystalnest.it"
+ }
+ maven {
+ name = "Fuzs Mod Resources"
+ url = "https://raw.githubusercontent.com/Fuzss/modresources/main/maven/"
+ }
+}
+
+if (name != "fabric") {
+ dependencies {
+ implementation "it.crystalnest:cobweb-$name:$minecraft_version-$cobweb_version"
+ implementation "it.crystalnest:soul-fire-d-$name:$minecraft_version-$soul_fire_d_version"
+ }
+}
+
+["apiElements", "runtimeElements", "sourcesElements", "javadocElements"].each { variant ->
+ configurations."$variant".outgoing {
+ capability("$group:${base.archivesName.get()}:$version")
+ capability("$group:$mod_id-${project.name}-$minecraft_version:$version")
+ capability("$group:$mod_id:$version")
+ }
+ publishing.publications.configureEach {
+ suppressPomMetadataWarningsFor(variant)
+ }
+}
+
+sourcesJar {
+ from(rootProject.file("LICENSE")) {
+ rename { "${it}_$mod_title" }
+ }
+}
+
+jar {
+ from(rootProject.file("LICENSE")) {
+ rename { "${it}_$mod_title" }
+ }
+ manifest {
+ attributes([
+ "Specification-Title" : mod_title,
+ "Specification-Vendor" : mod_authors,
+ "Specification-Version" : project.version,
+ "Implementation-Title" : mod_title,
+ "Implementation-Vendor" : mod_authors,
+ "Implementation-Version" : project.version,
+ "Implementation-URL" : "https://github.com/$github_user/$mod_id_kebab/tree/$minecraft_version",
+ "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
+ ])
+ }
+}
+
+processResources {
+ def expandProps = [
+ "java_version" : java_version,
+ "mod_version" : mod_version,
+ "group" : project.group,
+ "mod_authors" : mod_authors,
+ "mod_title" : mod_title,
+ "mod_id" : mod_id,
+ "mod_id_kebab" : mod_id_kebab,
+ "license" : license,
+ "description" : project.description,
+ "credits" : credits,
+ "github_user" : github_user,
+ "curseforge_id" : curseforge_id,
+ "minecraft_version" : minecraft_version,
+ "minecraft_version_range" : minecraft_version_range,
+ "fabric_version" : fabric_version,
+ "fabric_loader_version" : fabric_loader_version,
+ "neoforge_version" : neoforge_version,
+ "neoforge_loader_version_range": neoforge_loader_version_range,
+ "cobweb_version" : cobweb_version,
+ "soul_fire_d_version" : soul_fire_d_version,
+ "fcap_version" : fcap_version,
+ ]
+ filesMatching(["pack.mcmeta", "fabric.mod.json", "META-INF/neoforge.mods.toml", "*.mixins.json"]) {
+ expand expandProps
+ }
+ inputs.properties(expandProps)
+}
+
+def noPublish = name == "common"
+def changelog_body = "See [Changelog](https://github.com/$github_user/$mod_id_kebab/blob/master/CHANGELOG.md#v${mod_version.replaceAll('\\.', '')}---${new Date().format("yyyyMMdd")})."
+def version_type = mod_version.replaceFirst("([0-9]+\\.?)+-?", "") ?: "release"
+def loader = "Common"
+switch (name) {
+ case "fabric":
+ loader = "Fabric"
+ break
+ case "neoforge":
+ loader = "NeoForge"
+ break
+}
+
+publishing {
+ repositories {
+ maven {
+ name = "GitHubPackages"
+ url = uri("https://maven.pkg.github.com/$github_user/$mod_id_kebab")
+ credentials {
+ username = github_user
+ password = System.getenv("GITHUB_TOKEN") ?: ""
+ }
+ }
+ }
+ publications {
+ gpr(MavenPublication) {
+ groupId = project.group
+ artifactId = "$mod_id_kebab-${loader.toLowerCase()}"
+ version = project.version
+ from components.java
+ pom {
+ name = "[$loader - $minecraft_version] $mod_title v$mod_version"
+ description = "$description"
+ url = "https://github.com/$github_user/$mod_id_kebab/tree/$minecraft_version"
+ issueManagement {
+ system = "github"
+ url = "https://github.com/$github_user/$mod_id_kebab/issues"
+ }
+ licenses {
+ license {
+ name = license
+ url = "https://spdx.org/licenses/${license}.html"
+ }
+ }
+ developers {
+ mod_authors.split(", ").each { author ->
+ developer {
+ id = author.toLowerCase()
+ name = author
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+publisher {
+ apiKeys {
+ github System.getenv("GITHUB_TOKEN") ?: ""
+ modrinth System.getenv("MODRINTH_TOKEN") ?: ""
+ curseforge System.getenv("CURSEFORGE_TOKEN") ?: ""
+ }
+ setDebug(noPublish)
+ setVersion(mod_version)
+ setChangelog(changelog_body)
+ setVersionType(version_type)
+ setArtifact(jar)
+ setDisableMalwareScanner(true) // Disable the built in Fractureizer scanner.
+ setDisableEmptyJarCheck(true) // Disable check for valid mod metadata entry in artifact, which could possibly mean that the jar is empty.
+ setModrinthID(mod_id_kebab)
+ setCurseID(curseforge_id)
+ if (!noPublish) {
+ setLoaders(loader)
+ }
+ setGameVersions(minecraft_version)
+ setDisplayName("[$loader - $minecraft_version] $mod_title v$mod_version")
+ setJavaVersions([JavaVersion.VERSION_21]) // Remember to update this to match java_version gradle property.
+ setCurseEnvironment("both") // "server", "client" or "both".
+ github {
+ repo = "$github_user/$mod_id_kebab"
+ tag = "v${project.version}"
+ displayName("v${project.version}")
+ target = minecraft_version
+ createTag = true
+ createRelease = true
+ updateRelease = true
+ draft = false
+ }
+ modrinthDepends {
+ required "cobweb"
+ switch (loader) {
+ case "Fabric":
+ required "fabric-api"
+ required "forge-config-api-port"
+ break
+ case "NeoForge":
+ break
+ }
+ }
+ curseDepends {
+ required "cobweb"
+ switch (loader) {
+ case "Fabric":
+ required "fabric-api"
+ required "forge-config-api-port-fabric"
+ break
+ case "NeoForge":
+ break
+ }
+ }
+}
+
+tasks.register("publishLoader") {
+ group = "publishing"
+ description = "Publish $loader specific versions to all platforms"
+ dependsOn "publish"
+ dependsOn "publishMod"
+}
diff --git a/buildSrc/src/main/groovy/multiloader-loader.gradle b/buildSrc/src/main/groovy/multiloader-loader.gradle
new file mode 100644
index 0000000..618b808
--- /dev/null
+++ b/buildSrc/src/main/groovy/multiloader-loader.gradle
@@ -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)
+}
diff --git a/common/build.gradle b/common/build.gradle
index 2ef1995..5ff3108 100644
--- a/common/build.gradle
+++ b/common/build.gradle
@@ -1,19 +1,41 @@
plugins {
- id "org.spongepowered.gradle.vanilla" version "0.2.1-SNAPSHOT"
+ id "multiloader-common"
+ id "net.neoforged.moddev"
}
-minecraft {
- version(minecraft_version)
- if (file("src/main/resources/${mod_id}.accesswidener").exists()) {
- accessWideners(file("src/main/resources/${mod_id}.accesswidener"))
+neoForge {
+ neoFormVersion = neo_form_version
+ def at = file("src/main/resources/META-INF/accesstransformer.cfg")
+ if (at.exists()) {
+ accessTransformers.add(at.absolutePath)
+ }
+ parchment {
+ minecraftVersion = minecraft_version
+ mappingsVersion = parchment_version
}
}
dependencies {
compileOnly group: "org.spongepowered", name: "mixin", version: "0.8.5"
- implementation "it.crystalnest:cobweb-common:${minecraft_version}-${cobweb_version}"
- implementation "fuzs.forgeconfigapiport:forgeconfigapiport-common-neoforgeapi:${fcap_version}"
- implementation "it.crystalnest:soul-fire-d-common:${minecraft_version}-${soul_fire_d_version}"
+ compileOnly group: "io.github.llamalad7", name: "mixinextras-common", version: "0.3.5"
+ annotationProcessor group: "io.github.llamalad7", name: "mixinextras-common", version: "0.3.5"
+ implementation "fuzs.forgeconfigapiport:forgeconfigapiport-common-neoforgeapi:$fcap_version"
+}
+
+configurations {
+ commonJava {
+ canBeResolved = false
+ canBeConsumed = true
+ }
+ commonResources {
+ canBeResolved = false
+ canBeConsumed = true
+ }
+}
+
+artifacts {
+ commonJava sourceSets.main.java.sourceDirectories.singleFile
+ commonResources sourceSets.main.resources.sourceDirectories.singleFile
}
// Disable publishing tasks where common is not published
diff --git a/common/src/main/java/it/crystalnest/torch_hit/Constants.java b/common/src/main/java/it/crystalnest/torch_hit/Constants.java
index bc50c2e..dd9bdd1 100644
--- a/common/src/main/java/it/crystalnest/torch_hit/Constants.java
+++ b/common/src/main/java/it/crystalnest/torch_hit/Constants.java
@@ -14,7 +14,7 @@
@ApiStatus.Internal
public final class Constants {
/**
- * Mod id.
+ * Mod ID.
*/
public static final String MOD_ID = "torch_hit";
diff --git a/common/src/main/java/it/crystalnest/torch_hit/config/ModConfig.java b/common/src/main/java/it/crystalnest/torch_hit/config/ModConfig.java
index bf99e8c..4725be7 100644
--- a/common/src/main/java/it/crystalnest/torch_hit/config/ModConfig.java
+++ b/common/src/main/java/it/crystalnest/torch_hit/config/ModConfig.java
@@ -2,7 +2,6 @@
import it.crystalnest.cobweb.api.config.CommonConfig;
import it.crystalnest.torch_hit.Constants;
-import net.minecraft.world.item.enchantment.Enchantments;
import net.neoforged.neoforge.common.ModConfigSpec;
import org.jetbrains.annotations.ApiStatus;
@@ -227,7 +226,7 @@ public static Boolean getFireFromMobs() {
@Override
protected void define(ModConfigSpec.Builder builder) {
- int maxDuration = Enchantments.FIRE_ASPECT.getMaxLevel() * 4;
+ int maxDuration = 8; // Max Fire Aspect level (2) times Fire Aspect duration (4).
directHitDuration = builder.comment(" Fire damage duration for direct (main hand) hits.").defineInRange("direct hit duration", 4, 1, maxDuration);
indirectHitDuration = builder.comment(" Fire damage duration for indirect (offhand + tool) hits.").defineInRange("indirect hit duration", 2, 1, maxDuration);
indirectHitToolList = builder
diff --git a/common/src/main/java/it/crystalnest/torch_hit/handler/AttackHandler.java b/common/src/main/java/it/crystalnest/torch_hit/handler/AttackHandler.java
index bdb3c1b..a33360f 100644
--- a/common/src/main/java/it/crystalnest/torch_hit/handler/AttackHandler.java
+++ b/common/src/main/java/it/crystalnest/torch_hit/handler/AttackHandler.java
@@ -8,6 +8,7 @@
import net.minecraft.tags.ItemTags;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.monster.piglin.AbstractPiglin;
import net.minecraft.world.entity.player.Player;
@@ -21,8 +22,8 @@
/**
* Handles attack events.
*/
-public abstract class AttackHandler {
- protected AttackHandler() {}
+public final class AttackHandler {
+ private AttackHandler() {}
/**
* Handles the attack entity event.
@@ -31,7 +32,7 @@ protected AttackHandler() {}
* @param directEntity entity that actually dealt the damage.
* @param target targeted entity.
*/
- protected static void handle(Entity entity, Entity directEntity, LivingEntity target) {
+ public static void handle(Entity entity, Entity directEntity, LivingEntity target) {
if (entity instanceof LivingEntity attacker && entity.equals(directEntity) && !entity.level().isClientSide && !entity.isSpectator() && canAttack(attacker, target)) {
InteractionHand interactionHand = getInteractionHand(attacker);
if (interactionHand != null && !target.fireImmune()) {
@@ -69,7 +70,7 @@ private static void consumeItem(LivingEntity attacker, ItemStack item, boolean d
if (((isCandle(item) && ModConfig.getConsumeCandle()) || (isTorch(item) && ModConfig.getConsumeTorch())) && (directHit || ModConfig.getConsumeWithIndirectHits()) && (ModConfig.getConsumeWithoutFire() || seconds > 0)) {
item.shrink(1);
} else if (attacker.getMainHandItem().getItem() instanceof TieredItem tieredItem && tieredItem.getTier() == Tiers.WOOD && ModConfig.getIndirectHitToolDamage() > 0) {
- attacker.getMainHandItem().hurtAndBreak((tieredItem.getMaxDamage() * ModConfig.getIndirectHitToolDamage() + 99) / 100, attacker, livingEntity -> livingEntity.broadcastBreakEvent(InteractionHand.MAIN_HAND));
+ attacker.getMainHandItem().hurtAndBreak((tieredItem.getTier().getUses() * ModConfig.getIndirectHitToolDamage() + 99) / 100, attacker, EquipmentSlot.MAINHAND);
}
}
}
@@ -88,7 +89,7 @@ private static int torchHit(Entity target, ItemStack item, int defaultSeconds) {
if (Services.PLATFORM.isModLoaded("soul_fire_d")) {
SoulFired.setOnFire(item, target, seconds);
} else {
- target.setSecondsOnFire(seconds);
+ target.igniteForSeconds(seconds);
}
}
return seconds;
diff --git a/common/src/main/java/it/crystalnest/torch_hit/platform/Services.java b/common/src/main/java/it/crystalnest/torch_hit/platform/Services.java
index 26845db..3476fd0 100644
--- a/common/src/main/java/it/crystalnest/torch_hit/platform/Services.java
+++ b/common/src/main/java/it/crystalnest/torch_hit/platform/Services.java
@@ -2,7 +2,6 @@
import it.crystalnest.torch_hit.Constants;
import it.crystalnest.torch_hit.platform.services.PlatformHelper;
-import org.jetbrains.annotations.ApiStatus;
import java.util.ServiceLoader;
@@ -10,7 +9,6 @@
* Service loaders are a built-in Java feature that allow us to locate implementations of an interface that vary from one environment to another.
* In the context of MultiLoader we use this feature to access a mock API in the common code that is swapped out for the platform specific implementation at runtime.
*/
-@ApiStatus.Internal
public final class Services {
/**
* Provides information about what platform the mod is running on.
diff --git a/fabric/src/main/java/it/crystalnest/torch_hit/platform/package-info.java b/common/src/main/java/it/crystalnest/torch_hit/platform/package-info.java
similarity index 100%
rename from fabric/src/main/java/it/crystalnest/torch_hit/platform/package-info.java
rename to common/src/main/java/it/crystalnest/torch_hit/platform/package-info.java
diff --git a/common/src/main/resources/torch_hit.mixins.json b/common/src/main/resources/torch_hit.mixins.json
index 65644f7..aba61bd 100644
--- a/common/src/main/resources/torch_hit.mixins.json
+++ b/common/src/main/resources/torch_hit.mixins.json
@@ -3,7 +3,7 @@
"minVersion": "0.8",
"package": "${group}.${mod_id}.mixin",
"refmap": "${mod_id}.refmap.json",
- "compatibilityLevel": "JAVA_17",
+ "compatibilityLevel": "JAVA_${java_version}",
"mixins": [],
"client": [],
"server": [],
diff --git a/fabric/build.gradle b/fabric/build.gradle
index c21a0a6..8089292 100644
--- a/fabric/build.gradle
+++ b/fabric/build.gradle
@@ -1,19 +1,25 @@
-plugins {}
+plugins {
+ id "multiloader-loader"
+ id "fabric-loom"
+}
dependencies {
- minecraft "com.mojang:minecraft:${minecraft_version}"
- mappings loom.officialMojangMappings()
- modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
- modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
- compileOnly project(":common")
- modImplementation "it.crystalnest:cobweb-fabric:${minecraft_version}-${cobweb_version}"
- modImplementation "fuzs.forgeconfigapiport:forgeconfigapiport-fabric:${fcap_version}"
- modImplementation "it.crystalnest:soul-fire-d-fabric:${minecraft_version}-${soul_fire_d_version}"
+ minecraft "com.mojang:minecraft:$minecraft_version"
+ mappings loom.layered {
+ officialMojangMappings()
+ parchment("org.parchmentmc.data:parchment-$minecraft_version:$parchment_version@zip")
+ }
+ modImplementation "net.fabricmc:fabric-loader:$fabric_loader_version"
+ modImplementation "net.fabricmc.fabric-api:fabric-api:$fabric_version"
+ modImplementation "it.crystalnest:cobweb-$name:$minecraft_version-$cobweb_version"
+ modImplementation "fuzs.forgeconfigapiport:forgeconfigapiport-fabric:$fcap_version"
+ modImplementation "it.crystalnest:soul-fire-d-fabric:$minecraft_version-$soul_fire_d_version"
}
loom {
- if (project(":common").file("src/main/resources/${mod_id}.accesswidener").exists()) {
- accessWidenerPath.set(project(":common").file("src/main/resources/${mod_id}.accesswidener"))
+ def aw = project(":common").file("src/main/resources/${mod_id}.accesswidener")
+ if (aw.exists()) {
+ accessWidenerPath.set(aw)
}
mixin {
defaultRefmapName.set("${mod_id}.refmap.json")
@@ -23,27 +29,17 @@ loom {
client()
setConfigName("Fabric Client")
ideConfigGenerated(true)
- runDir("run")
+ runDir("run/client")
}
server {
server()
setConfigName("Fabric Server")
ideConfigGenerated(true)
- runDir("run")
+ runDir("run/client")
}
}
}
-tasks.withType(JavaCompile).configureEach {
- source(project(":common").sourceSets.main.allSource)
-}
-tasks.withType(Javadoc).configureEach {
- source(project(":common").sourceSets.main.allJava)
-}
-tasks.named("sourcesJar", Jar) {
- from(project(":common").sourceSets.main.allSource)
-}
-
-processResources {
- from project(":common").sourceSets.main.resources
+publisher {
+ setArtifact(remapJar)
}
diff --git a/fabric/src/main/java/it/crystalnest/torch_hit/handler/FabricAttackHandler.java b/fabric/src/main/java/it/crystalnest/torch_hit/handler/FabricAttackHandler.java
index 62b1a5e..2478071 100644
--- a/fabric/src/main/java/it/crystalnest/torch_hit/handler/FabricAttackHandler.java
+++ b/fabric/src/main/java/it/crystalnest/torch_hit/handler/FabricAttackHandler.java
@@ -6,7 +6,7 @@
/**
* Fabric attack handler.
*/
-public final class FabricAttackHandler extends AttackHandler {
+public final class FabricAttackHandler {
private FabricAttackHandler() {}
/**
@@ -18,7 +18,7 @@ private FabricAttackHandler() {}
* @return whether the target can be damaged.
*/
public static boolean handle(LivingEntity target, DamageSource source, float amount) {
- handle(source.getEntity(), source.getDirectEntity(), target);
+ AttackHandler.handle(source.getEntity(), source.getDirectEntity(), target);
return true;
}
}
diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json
index 8287ce1..687129f 100644
--- a/fabric/src/main/resources/fabric.mod.json
+++ b/fabric/src/main/resources/fabric.mod.json
@@ -28,7 +28,7 @@
"fabricloader": ">=${fabric_loader_version}",
"fabric-api": "*",
"minecraft": "${minecraft_version}",
- "java": ">=17",
+ "java": ">=${java_version}",
"cobweb": "^${cobweb_version}",
"forgeconfigapiport": "~${fcap_version}"
},
diff --git a/fabric/src/main/resources/torch_hit.fabric.mixins.json b/fabric/src/main/resources/torch_hit.fabric.mixins.json
index f588bd5..d562379 100644
--- a/fabric/src/main/resources/torch_hit.fabric.mixins.json
+++ b/fabric/src/main/resources/torch_hit.fabric.mixins.json
@@ -3,7 +3,7 @@
"minVersion": "0.8",
"package": "${group}.${mod_id}.mixin",
"refmap": "${mod_id}.refmap.json",
- "compatibilityLevel": "JAVA_17",
+ "compatibilityLevel": "JAVA_${java_version}",
"mixins": [],
"client": [],
"server": [],
diff --git a/forge/build.gradle b/forge/build.gradle
deleted file mode 100644
index b4020a6..0000000
--- a/forge/build.gradle
+++ /dev/null
@@ -1,110 +0,0 @@
-plugins {
- id "net.minecraftforge.gradle" version "[6.0,6.2)"
- id "org.spongepowered.mixin" version "0.7-SNAPSHOT"
-}
-
-mixin {
- add(sourceSets.main, "${mod_id}.refmap.json")
- config("${mod_id}.mixins.json")
- config("${mod_id}.forge.mixins.json")
-}
-
-minecraft {
- mappings channel: "official", version: minecraft_version
-
- copyIdeResources = true // Calls processResources when in dev
-
- if (file("src/main/resources/META-INF/accesstransformer.cfg").exists()) {
- accessTransformer = file("src/main/resources/META-INF/accesstransformer.cfg")
- }
-
- runs {
- client {
- workingDirectory project.file("run")
- ideaModule "${rootProject.name}.${project.name}.main"
- taskName "Client"
- property "mixin.env.remapRefMap", 'true'
- property "mixin.env.refMapRemappingFile", "${projectDir}/build/createSrgToMcp/output.srg"
- mods {
- modClientRun {
- source sourceSets.main
- source project(":common").sourceSets.main
- }
- }
- }
-
- server {
- workingDirectory project.file("run")
- ideaModule "${rootProject.name}.${project.name}.main"
- taskName "Server"
- property "mixin.env.remapRefMap", "true"
- property "mixin.env.refMapRemappingFile", "${projectDir}/build/createSrgToMcp/output.srg"
- mods {
- modServerRun {
- source sourceSets.main
- source project(":common").sourceSets.main
- }
- }
- }
-
- data {
- workingDirectory project.file("run")
- ideaModule "${rootProject.name}.${project.name}.main"
- args "--mod", mod_id, "--all", "--output", file("src/generated/resources/"), "--existing", file("src/main/resources/")
- taskName "Data"
- property "mixin.env.remapRefMap", "true"
- property "mixin.env.refMapRemappingFile", "${projectDir}/build/createSrgToMcp/output.srg"
- mods {
- modDataRun {
- source sourceSets.main
- source project(":common").sourceSets.main
- }
- }
- }
- }
-}
-
-sourceSets.main.resources.srcDir "src/generated/resources"
-
-dependencies {
- minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
- compileOnly project(":common")
- annotationProcessor("org.spongepowered:mixin:0.8.5-SNAPSHOT:processor")
- implementation fg.deobf("it.crystalnest:cobweb-forge:${minecraft_version}-${cobweb_version}")
- implementation fg.deobf("fuzs.forgeconfigapiport:forgeconfigapiport-forge:${fcap_version}")
- implementation fg.deobf("it.crystalnest:soul-fire-d-forge:${minecraft_version}-${soul_fire_d_version}")
-}
-
-tasks.withType(JavaCompile).configureEach {
- source(project(":common").sourceSets.main.allSource)
-}
-tasks.withType(Javadoc).configureEach {
- source(project(":common").sourceSets.main.allJava)
-}
-tasks.named("sourcesJar", Jar) {
- from(project(":common").sourceSets.main.allSource)
-}
-
-processResources {
- from project(":common").sourceSets.main.resources
-}
-
-jar.finalizedBy("configureReobfTaskForReobfJar")
-jar.finalizedBy("reobfJar")
-
-// Task seems bugged, breaks build because of mod dependencies in the Common project, with no apparent workaround.
-tasks.named("compileTestJava").get().setEnabled(false)
-
-sourceSets.each {
- def dir = layout.buildDirectory.dir("sourcesSets/$it.name")
- it.output.resourcesDir = dir
- it.java.destinationDirectory = dir
-}
-
-publishing {
- publications {
- gpr(MavenPublication) {
- fg.component(it)
- }
- }
-}
diff --git a/forge/src/main/java/it/crystalnest/torch_hit/ModLoader.java b/forge/src/main/java/it/crystalnest/torch_hit/ModLoader.java
deleted file mode 100644
index d7fd834..0000000
--- a/forge/src/main/java/it/crystalnest/torch_hit/ModLoader.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package it.crystalnest.torch_hit;
-
-import net.minecraftforge.fml.common.Mod;
-import org.jetbrains.annotations.ApiStatus;
-
-/**
- * Mod loader.
- */
-@ApiStatus.Internal
-@Mod(Constants.MOD_ID)
-public final class ModLoader {
- /**
- * Mod initialization.
- */
- public ModLoader() {
- CommonModLoader.init();
- }
-}
diff --git a/forge/src/main/java/it/crystalnest/torch_hit/handler/ForgeAttackHandler.java b/forge/src/main/java/it/crystalnest/torch_hit/handler/ForgeAttackHandler.java
deleted file mode 100644
index d06d5e2..0000000
--- a/forge/src/main/java/it/crystalnest/torch_hit/handler/ForgeAttackHandler.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package it.crystalnest.torch_hit.handler;
-
-import it.crystalnest.torch_hit.Constants;
-import net.minecraftforge.event.entity.living.LivingAttackEvent;
-import net.minecraftforge.eventbus.api.SubscribeEvent;
-import net.minecraftforge.fml.common.Mod;
-
-/**
- * Forge attack handler.
- */
-@Mod.EventBusSubscriber(modid = Constants.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE)
-public final class ForgeAttackHandler extends AttackHandler {
- private ForgeAttackHandler() {}
-
- /**
- * Handles the {@link LivingAttackEvent}.
- *
- * @param event {@link LivingAttackEvent}.
- */
- @SubscribeEvent
- public static void handle(LivingAttackEvent event) {
- handle(event.getSource().getEntity(), event.getSource().getDirectEntity(), event.getEntity());
- }
-}
diff --git a/forge/src/main/java/it/crystalnest/torch_hit/platform/ForgePlatformHelper.java b/forge/src/main/java/it/crystalnest/torch_hit/platform/ForgePlatformHelper.java
deleted file mode 100644
index 4cf3108..0000000
--- a/forge/src/main/java/it/crystalnest/torch_hit/platform/ForgePlatformHelper.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package it.crystalnest.torch_hit.platform;
-
-import it.crystalnest.cobweb.platform.model.Platform;
-import it.crystalnest.torch_hit.platform.services.PlatformHelper;
-import net.minecraftforge.fml.ModList;
-import net.minecraftforge.fml.loading.FMLLoader;
-
-/**
- * Forge platform helper.
- */
-public final class ForgePlatformHelper implements PlatformHelper {
- @Override
- public Platform getPlatformName() {
- return Platform.FORGE;
- }
-
- @Override
- public boolean isModLoaded(String modId) {
- return ModList.get().isLoaded(modId);
- }
-
- @Override
- public boolean isDevEnv() {
- return !FMLLoader.isProduction();
- }
-}
diff --git a/forge/src/main/java/it/crystalnest/torch_hit/platform/package-info.java b/forge/src/main/java/it/crystalnest/torch_hit/platform/package-info.java
deleted file mode 100644
index 55fea86..0000000
--- a/forge/src/main/java/it/crystalnest/torch_hit/platform/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-@ApiStatus.Internal
-package it.crystalnest.torch_hit.platform;
-
-import org.jetbrains.annotations.ApiStatus;
diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml
deleted file mode 100644
index 6295186..0000000
--- a/forge/src/main/resources/META-INF/mods.toml
+++ /dev/null
@@ -1,44 +0,0 @@
-modLoader = "javafml" #mandatory
-loaderVersion = "${forge_loader_version_range}" #mandatory
-license = "${license}"
-issueTrackerURL="https://github.com/${github_user}/${mod_id_kebab}/issues" #optional
-[[mods]] #mandatory
- modId = "${mod_id}" #mandatory
- version = "${mod_version}" #mandatory
- displayName = "${mod_title}" #mandatory
- updateJSONURL = "https://api.modrinth.com/updates/${mod_id_kebab}/forge_updates.json" #optional (see https://docs.neoforged.net/docs/misc/updatechecker/)
- displayURL = "https://github.com/${github_user}/${mod_id_kebab}/tree/${minecraft_version}" #optional (displayed in the mod UI)
- logoFile = "banner.png" #optional
- credits = "${credits}" #optional
- authors = "${mod_authors}" #optional
- description = '''${description}''' #mandatory (Supports multiline text)
-[[dependencies.${mod_id}]] #optional
- modId = "forge" #mandatory
- mandatory = true #mandatory
- versionRange = "${forge_loader_version_range}" #mandatory
- ordering = "NONE" # The order that this dependency should load in relation to your mod, required to be either 'BEFORE' or 'AFTER' if the dependency is not mandatory
- side = "BOTH" # Side this dependency is applied on - 'BOTH', 'CLIENT' or 'SERVER'
-[[dependencies.${mod_id}]]
- modId = "minecraft"
- mandatory = true
- versionRange = "${minecraft_version_range}"
- ordering = "NONE"
- side = "BOTH"
-[[dependencies.${mod_id}]]
- modId = "cobweb"
- mandatory = true
- versionRange = "[${cobweb_version},)"
- ordering = "NONE"
- side = "BOTH"
-[[dependencies.${mod_id}]]
- modId = "forgeconfigapiport"
- mandatory = true
- versionRange = "[${fcap_version},)"
- ordering = "NONE"
- side = "BOTH"
-[[dependencies.${mod_id}]]
- modId = "soul_fire_d"
- mandatory = false
- versionRange = "[${soul_fire_d_version},)"
- ordering = "BEFORE"
- side = "BOTH"
diff --git a/forge/src/main/resources/META-INF/services/it.crystalnest.torch_hit.platform.services.PlatformHelper b/forge/src/main/resources/META-INF/services/it.crystalnest.torch_hit.platform.services.PlatformHelper
deleted file mode 100644
index 6b1d8c9..0000000
--- a/forge/src/main/resources/META-INF/services/it.crystalnest.torch_hit.platform.services.PlatformHelper
+++ /dev/null
@@ -1 +0,0 @@
-it.crystalnest.torch_hit.platform.ForgePlatformHelper
\ No newline at end of file
diff --git a/forge/src/main/resources/torch_hit.forge.mixins.json b/forge/src/main/resources/torch_hit.forge.mixins.json
deleted file mode 100644
index f588bd5..0000000
--- a/forge/src/main/resources/torch_hit.forge.mixins.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "required": true,
- "minVersion": "0.8",
- "package": "${group}.${mod_id}.mixin",
- "refmap": "${mod_id}.refmap.json",
- "compatibilityLevel": "JAVA_17",
- "mixins": [],
- "client": [],
- "server": [],
- "injectors": {
- "defaultRequire": 1
- }
-}
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
index 5383c44..44e01d9 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,6 +1,7 @@
# Every field must be added to the root build.gradle expandProps map.
# Common
+java_version = 21
mod_version = 7.0.0
group = it.crystalnest
mod_authors = Crystal Spider, Moonstone Webber, Noir
@@ -12,25 +13,25 @@ description = Attack with torches!
credits =
github_user = crystal-nest
curseforge_id = 629434
-minecraft_version = 1.20.4
-minecraft_version_range = [1.20.4,)
+minecraft_version = 1.21
+minecraft_version_range = [1.21,)
+# https://parchmentmc.org/docs/getting-started#choose-a-version
+parchment_version = 2024.06.23
+# https://projects.neoforged.net/neoforged/neoform
+neo_form_version = 1.21-20240613.152323
# Fabric
-fabric_version = 0.92.1+1.20.4
-fabric_loader_version = 0.15.3
-
-# Forge
-forge_version = 49.0.30
-forge_loader_version_range = [49,)
+fabric_version = 0.100.6+1.21
+fabric_loader_version = 0.15.11
# NeoForge
-neoforge_version = 20.4.170
-neoforge_loader_version_range = [20.4,)
+neoforge_version = 21.0.59-beta
+neoforge_loader_version_range = [21.0,)
# Dependencies
cobweb_version = 1.0.0
-fcap_version = 20.4.3
-soul_fire_d_version = 4.0.2
+fcap_version = 21.0.1
+soul_fire_d_version = 5.0.0
# Gradle
org.gradle.jvmargs = -Xmx4G
diff --git a/neoforge/build.gradle b/neoforge/build.gradle
index 1b465dc..04f2adc 100644
--- a/neoforge/build.gradle
+++ b/neoforge/build.gradle
@@ -1,58 +1,38 @@
plugins {
- id "net.neoforged.gradle.userdev" version "7.0.84"
+ id "multiloader-loader"
+ id "net.neoforged.moddev"
}
-if (file("src/main/resources/META-INF/accesstransformer.cfg").exists()) {
- minecraft.accessTransformers.file file("src/main/resources/META-INF/accesstransformer.cfg")
-}
-runs {
- configureEach {
- modSource project.sourceSets.main
- }
- client {
- systemProperty "neoforge.enabledGameTestNamespaces", mod_id
+neoForge {
+ version = neoforge_version
+ def at = project(':common').file('src/main/resources/META-INF/accesstransformer.cfg')
+ if (at.exists()) {
+ accessTransformers.add(at.absolutePath)
}
- server {
- systemProperty "neoforge.enabledGameTestNamespaces", mod_id
- programArgument "--nogui"
+ parchment {
+ minecraftVersion = minecraft_version
+ mappingsVersion = parchment_version
}
-
- gameTestServer {
- systemProperty "neoforge.enabledGameTestNamespaces", mod_id
+ runs {
+ configureEach {
+ systemProperty('neoforge.enabledGameTestNamespaces', mod_id)
+ ideName = "NeoForge ${it.name.capitalize()} (${project.path})" // Unify the run config names with fabric
+ }
+ client {
+ client()
+ }
+ data {
+ data()
+ }
+ server {
+ server()
+ }
}
-
- data {
- programArguments.addAll "--mod", mod_id, "--all", "--output", file("src/generated/resources/").getAbsolutePath(), "--existing", file("src/main/resources/").getAbsolutePath()
+ mods {
+ "${mod_id}" {
+ sourceSet sourceSets.main
+ }
}
}
sourceSets.main.resources { srcDir "src/generated/resources" }
-
-dependencies {
- implementation "net.neoforged:neoforge:${neoforge_version}"
- implementation project(":common")
- implementation "it.crystalnest:cobweb-neoforge:${minecraft_version}-${cobweb_version}"
- implementation "it.crystalnest:soul-fire-d-neoforge:${minecraft_version}-${soul_fire_d_version}"
-}
-
-// NeoGradle compiles the game, but we don't want to add our common code to the game's code
-Spec notNeoTask = { Task it -> !it.name.startsWith("neo") } as Spec
-
-tasks.withType(JavaCompile).matching(notNeoTask).configureEach {
- source(project(":common").sourceSets.main.allSource)
-}
-
-tasks.withType(Javadoc).matching(notNeoTask).configureEach {
- source(project(":common").sourceSets.main.allJava)
-}
-
-tasks.named("sourcesJar", Jar) {
- from(project(":common").sourceSets.main.allSource)
-}
-
-tasks.withType(ProcessResources).matching(notNeoTask).configureEach {
- from project(":common").sourceSets.main.resources
-}
-
-// Task seems bugged, breaks build because of mod dependencies in the Common project, with no apparent workaround.
-tasks.named('compileTestJava').get().setEnabled(false)
diff --git a/neoforge/src/main/java/it/crystalnest/torch_hit/handler/NeoForgeAttackHandler.java b/neoforge/src/main/java/it/crystalnest/torch_hit/handler/NeoForgeAttackHandler.java
index a37942b..b7c97d1 100644
--- a/neoforge/src/main/java/it/crystalnest/torch_hit/handler/NeoForgeAttackHandler.java
+++ b/neoforge/src/main/java/it/crystalnest/torch_hit/handler/NeoForgeAttackHandler.java
@@ -2,23 +2,23 @@
import it.crystalnest.torch_hit.Constants;
import net.neoforged.bus.api.SubscribeEvent;
-import net.neoforged.fml.common.Mod;
-import net.neoforged.neoforge.event.entity.living.LivingAttackEvent;
+import net.neoforged.fml.common.EventBusSubscriber;
+import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent;
/**
* NeoForge attack handler.
*/
-@Mod.EventBusSubscriber(modid = Constants.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE)
-public final class NeoForgeAttackHandler extends AttackHandler {
+@EventBusSubscriber(modid = Constants.MOD_ID, bus = EventBusSubscriber.Bus.GAME)
+public final class NeoForgeAttackHandler {
private NeoForgeAttackHandler() {}
/**
- * Handles the {@link LivingAttackEvent}.
+ * Handles the {@link LivingIncomingDamageEvent}.
*
- * @param event {@link LivingAttackEvent}.
+ * @param event {@link LivingIncomingDamageEvent}.
*/
@SubscribeEvent
- public static void handle(LivingAttackEvent event) {
- handle(event.getSource().getEntity(), event.getSource().getDirectEntity(), event.getEntity());
+ public static void handle(LivingIncomingDamageEvent event) {
+ AttackHandler.handle(event.getSource().getEntity(), event.getSource().getDirectEntity(), event.getEntity());
}
}
diff --git a/neoforge/src/main/java/it/crystalnest/torch_hit/platform/package-info.java b/neoforge/src/main/java/it/crystalnest/torch_hit/platform/package-info.java
deleted file mode 100644
index 55fea86..0000000
--- a/neoforge/src/main/java/it/crystalnest/torch_hit/platform/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-@ApiStatus.Internal
-package it.crystalnest.torch_hit.platform;
-
-import org.jetbrains.annotations.ApiStatus;
diff --git a/neoforge/src/main/resources/META-INF/mods.toml b/neoforge/src/main/resources/META-INF/neoforge.mods.toml
similarity index 98%
rename from neoforge/src/main/resources/META-INF/mods.toml
rename to neoforge/src/main/resources/META-INF/neoforge.mods.toml
index bf1990a..a848b30 100644
--- a/neoforge/src/main/resources/META-INF/mods.toml
+++ b/neoforge/src/main/resources/META-INF/neoforge.mods.toml
@@ -1,5 +1,5 @@
modLoader = "javafml" #mandatory
-loaderVersion = "[2,)" #mandatory
+loaderVersion = "[4,)" #mandatory
license = "${license}" #mandatory
issueTrackerURL="https://github.com/${github_user}/${mod_id_kebab}/issues" #optional
[[mods]] #mandatory
diff --git a/neoforge/src/main/resources/torch_hit.neoforge.mixins.json b/neoforge/src/main/resources/torch_hit.neoforge.mixins.json
index 5d29c43..009e244 100644
--- a/neoforge/src/main/resources/torch_hit.neoforge.mixins.json
+++ b/neoforge/src/main/resources/torch_hit.neoforge.mixins.json
@@ -2,7 +2,7 @@
"required": true,
"minVersion": "0.8",
"package": "${group}.${mod_id}.mixin",
- "compatibilityLevel": "JAVA_17",
+ "compatibilityLevel": "JAVA_${java_version}",
"mixins": [],
"client": [],
"server": [],
diff --git a/settings.gradle b/settings.gradle
index 26a79b4..56ce757 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,24 +1,19 @@
pluginManagement {
repositories {
gradlePluginPortal()
- maven {
- name = "Fabric"
- url = "https://maven.fabricmc.net/"
- }
- maven {
- name = "NeoForge"
- url = "https://maven.neoforged.net/releases/"
- }
- maven {
- name = "Forge"
- url = "https://maven.minecraftforge.net/"
- }
- maven {
- name = "Sponge Snapshots"
- url = "https://repo.spongepowered.org/repository/maven-public/"
- }
- maven {
- url "https://maven.firstdark.dev/releases"
+ mavenCentral()
+ maven { url "https://maven.firstdark.dev/releases" }
+ exclusiveContent {
+ forRepository {
+ maven {
+ name = "Fabric"
+ url = uri('https://maven.fabricmc.net')
+ }
+ }
+ filter {
+ includeGroup("net.fabricmc")
+ includeGroup("fabric-loom")
+ }
}
}
}
@@ -31,5 +26,4 @@ plugins {
rootProject.name = "torch-hit"
include("common")
include("fabric")
-include("forge")
include("neoforge")