Skip to content

Commit

Permalink
Port to 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
Crystal-Spider committed Jul 11, 2024
1 parent f89bf3d commit a14a965
Show file tree
Hide file tree
Showing 42 changed files with 551 additions and 952 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ out
*.ipr
*.iws
*.iml
.idea/*
!.idea/scopes
.idea

# gradle
build
Expand Down
3 changes: 0 additions & 3 deletions .idea/scopes/Fabric_sources.xml

This file was deleted.

3 changes: 0 additions & 3 deletions .idea/scopes/Forge_sources.xml

This file was deleted.

7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ and this project adheres to [Crystal Nest Semantic Versioning](https://crystalne

- Nothing new.

## [v9.0.1] - 2024/07/11

- Ported to 1.21
- Officially dropped support for Forge.
- Added new configuration option `tiers` to specify the tier order (and thus levels) since Minecraft stripped tiers from their levels.
- Added new API method to retrieve a `TieredItem` tier level.

## [v9.0.1] - 2024/06/27

- Fix [#44](https://github.com/Crystal-Nest/harvest-with-ease/issues/44), config value resets itself each start.
Expand Down
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![Harvest with ease banner](https://raw.githubusercontent.com/crystal-nest/mod-fancy-assets/main/harvest-with-ease/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/harvest-with-ease/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/crystal-nest/mod-fancy-assets/main/minecraft/1-20-2.svg)](https://modrinth.com/mod/harvest-with-ease/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/harvest-with-ease/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/harvest-with-ease/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/harvest-with-ease/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/harvest-with-ease/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)](https://modrinth.com/mod/harvest-with-ease/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/harvest-with-ease/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/crystal-nest/mod-fancy-assets/main/minecraft/1-20-2.svg)](https://modrinth.com/mod/harvest-with-ease/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/harvest-with-ease/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/harvest-with-ease/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/harvest-with-ease/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/harvest-with-ease/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/harvest-with-ease/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/harvest-with-ease/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/harvest-with-ease/versions?l=fabric)

Expand Down Expand Up @@ -32,24 +32,25 @@ It's also compatible with **almost any** modded crops, to ease your mind of one

## **Configuration**

- **`require hoe`**: whether holding a hoe (either hands) is required to right-click harvest, defaults to `false`.
- **`damage on harvest`**: how much damage the hoe should receive upon use, effective only if `> 0` and **`require hoe`** is enabled.
- **`exp on harvest`**: how many experience points should be granted when right-click harvesting or break-harvesting, effective only if `> 0` (note it's exp _points_ and not exp _levels_).
- **`multi-harvest starting tier`**:
- `require hoe`: whether holding a hoe (either hands) is required to right-click harvest, defaults to `false`.
- `damage on harvest`: how much damage the hoe should receive upon use, effective only if `> 0` and **`require hoe`** is enabled.
- `exp on harvest`: how many experience points should be granted when right-click harvesting or break-harvesting, effective only if `> 0` (note it's exp _points_ and not exp _levels_).
- `multi-harvest starting tier`:
Tool tier starting from which it is possible to harvest multiple crops at once.
All tiers that cannot multi-harvest will have a 1x1 square area of effect (a single crop).
If **`starting harvest area size`** is set to `single` and **`area increment step`** to `none` multi-harvest will be effectively disabled, regardless of this config option value.
When set to `none` multi-harvest will be enabled without a tool too. Note that **`require hoe`** takes precedence.
- **`starting harvest area size`**:
- `starting harvest area size`:
Starting multi-harvest area size (square side length).
The area is always a square centered on the right-clicked crop.
Setting this to `single` and **`area increment step`** to `none` will effectively disable multi-harvest.
- **`area increment step`**:
- `area increment step`:
Increment step for the harvest area size with higher tool tiers.
Setting this to `none` and **`starting harvest area size`** to `single` will effectively disable multi-harvest.
- **`crops`**: list of additional in-game IDs for crops that are not supported out of the box, defaults to an empty list.
- `crops`: list of additional in-game IDs for crops that are not supported out of the box, defaults to an empty list.
This last config option is just a safety measure, so far no crop needs it.
- **`blacklist`**: list in-game IDs for crops that under no condition can be right-click harvested.
- `blacklist`: list in-game IDs for crops that under no condition can be right-click harvested.
- `tiers`: since 1.21, Minecraft removed the concept of tier levels, so you need to specify yourself the tier order. Provides a default value.

## **Dependencies**

Expand Down
238 changes: 3 additions & 235 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,252 +1,20 @@
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"
property "sonar.qualitygate.wait", "true"
}
}

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,
]

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("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 "Forge":
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 "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"
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"
}
Loading

0 comments on commit a14a965

Please sign in to comment.