Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.21 - v3.0.0 #14

Merged
merged 16 commits into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
433 changes: 401 additions & 32 deletions .editorconfig

Large diffs are not rendered by default.

18 changes: 13 additions & 5 deletions .github/workflows/build-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ name: build-commit
on:
push:
paths-ignore:
- "readme.md"
- "README.md"
- "LICENSE"
- ".gitignore"
- "changelog.md"
- ".editorconfig"
- "src/*/resources/lang/*"
pull_request:
paths-ignore:
- "readme.md"
- "README.md"
- "LICENSE"
- ".gitignore"
- "changelog.md"
Expand All @@ -38,9 +38,17 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build with Gradle
uses: Wandalen/wretry.action@master
with:
command: ./gradlew buildAllVersions --stacktrace
run: ./gradlew buildAllVersions --stacktrace
- uses: actions/upload-artifact@v4
with:
path: versions/**/build/libs/*.jar

modrinth-description:
runs-on: ubuntu-latest
name: Sync Modrinth description
steps:
- uses: actions/checkout@v4
- uses: funnyboy-roks/[email protected]
with:
auth-token: ${{ secrets.MODRINTH_API_KEY }}
slug: 'skylper'
14 changes: 11 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Release with Gradle
uses: Wandalen/wretry.action@master
with:
command: ./gradlew releaseAllVersions --stacktrace
run: ./gradlew releaseAllVersions postUpdate --stacktrace
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MODRINTH_API_KEY: ${{ secrets.MODRINTH_API_KEY }}
Expand All @@ -33,3 +31,13 @@ jobs:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_SECRET_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_SECRET_KEY_PASSWORD }}
GPG_SECRET_KEY_ID: ${{ secrets.GPG_SECRET_KEY_ID }}

modrinth-description:
runs-on: ubuntu-latest
name: Sync Modrinth description
steps:
- uses: actions/checkout@v4
- uses: funnyboy-roks/[email protected]
with:
auth-token: ${{ secrets.MODRINTH_API_KEY }}
slug: 'skylper'
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
**/.gradle/
**/run/
!run/mods/
**/build/
**/build/
.kotlin
**/.cache
94 changes: 19 additions & 75 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,92 +1,36 @@
# telekinesis

This mod/plugin adds the telekinesis enchantment, allowing you to instantly move drops into your inventory:

## Supported drops
- block drops
- mob drops
- exp drops
- shearing drops (fabric only)
- vehicle drops (fabric only)
- fishing drops (fabric only)

## Compatibility
The paper module of telekinesis is as of Minecraft version 1.20.2 discontinued cause of the lack of ability to
register the enchantment (I will figure a way out when I have time to, but it seems like this step is linked with way more reflection than before.)
This mod/plugin adds the telekinesis enchantment, allowing you to instantly move drops into your inventory.

## Configuration

The configuration file can be found in the client/server directory.
The file differs cause of the supported drops between fabric and paper environments.

-> mod configuration file: `/config/telekinesis.toml`
<br>
-> plugin configuration file: `/plugins/telekinesis.toml`
-> configuration file: `/config/telekinesis.json`

<details>
<summary>telekinesis.toml</summary>

<details>
<summary>paper config</summary>

```toml
# Uncomment the following values if you want to change them:
#
# Decides whether telekinesis can be used without the enchantment.
onByDefault = false
# Uncomment this to block functionality for those who don't have the required permission.
# onByDefaultPermissionRequirement = 'permission'
#
# Decides whether players should be required to sneak to use telekinesis.
onlyOnSneak = false
# Decides whether telekinesis can be used for block drops.
blockDrops = true
# blockDropsPermissionRequirement = 'permission'
#
# Decides whether telekinesis can be used for exp drops.
expDrops = true
# expDropsPermissionRequirement = 'permission'
#
# Decides whether telekinesis can be used for entity drops.
entityDrops = true
# entityDropsPermissionRequirement = 'permission'
#
# Decides whether to add the enchantment to the game.
enchantment = true
```
</details>

<details>
<summary>fabric config</summary>

```toml
# Uncomment the following values if you want to change them:
#
# Decides whether telekinesis can be used without the enchantment.
onByDefault = false
# Decides whether players should be required to sneak to use telekinesis.
onlyOnSneak = false
# Decides whether to add the enchantment to the game.
enchantment = true
# Decides whether telekinesis can be used for block drops.
blockDrops = true
# Decides whether telekinesis can be used for exp drops.
expDrops = true
# Decides whether telekinesis can be used for mob drops.
mobDrops = true
# Decides whether telekinesis can be used for vehicle drops.
vehicleDrops = true
# Decides whether telekinesis can be used for shearing drops.
shearingDrops = true
# Decides whether telekinesis can be used for fishing drops.
fishingDrops = true
```json
{
"version": 1, // Only for migration purposes, just ignore this.
"config": {
"needEnchantment": true, // Defines, whether telekinesis should without or with the enchantment on the tool.
"needSneak": false, // Defines. whether the player should have to sneak in order to use telekinesis.
"expAllowed": true, // Enables the use of telekinesis for exp drops.
"itemsAllowed": true // Enables the use of telekinesis for item drops.
}
}
```
</details>

</details>

### Other
⚠️ The development version is always the latest stable release of Minecraft.
Therefore, new features will only be available for the current and following Minecraft versions.

Currently supported versions are: 1.20.1, 1.20.4, 1.20.6 and 1.21. This can change in the future!

If you need help with any of my mods, just join my [discord server](https://nyon.dev/discord)

#### Paper Compatibility

The paper module of telekinesis is as of Minecraft version 1.20.2 discontinued cause of the lack of ability to
register the enchantment (When Paper's registry modification api is merged I will continue.)
198 changes: 192 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,203 @@
plugins {
kotlin("jvm") version "1.9.24"
kotlin("plugin.serialization") version "1.9.24"
@file:Suppress("SpellCheckingInspection", "SENSELESS_COMPARISON")

id("me.modmuss50.mod-publish-plugin") version "0.5.+"
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

id("fabric-loom") version "1.6-SNAPSHOT" apply (false)
plugins {
kotlin("jvm") version "2.0.0"
kotlin("plugin.serialization") version "2.0.0"
id("fabric-loom") version "1.7-SNAPSHOT"

id("io.papermc.paperweight.userdev") version "1.5.5" apply (false)
id("me.modmuss50.mod-publish-plugin") version "0.5.+"

`maven-publish`
signing
}

val beta: Int = 1 // Pattern is '1.0.0-beta1-1.20.6-pre.2'
val featureVersion = "1.0.0${if (beta != null) "-beta$beta" else ""}"
val mcVersion = property("mcVersion")!!.toString()
val mcVersionRange = property("mcVersionRange")!!.toString()
version = "$featureVersion-$mcVersion"

group = "dev.nyon"
val projectAuthors = listOf("btwonion")
val githubRepo = "btwonion/telekinesis"

base {
archivesName.set(rootProject.name)
}

loom {
if (stonecutter.current.isActive) {
runConfigs.all {
ideConfigGenerated(true)
runDir("../../run")
}
}

mixin { useLegacyMixinAp = false }
}

// Enable data generation for >1.20.6
if (!listOf("1.20.1", "1.20.4", "1.20.6").contains(stonecutter.current.version)) {
fabricApi {
configureDataGeneration()
}
}

repositories {
mavenCentral()
exclusiveContent {
forRepository {
maven("https://api.modrinth.com/maven")
}
filter {
includeGroup("maven.modrinth")
}
}
maven("https://maven.terraformersmc.com")
maven("https://maven.parchmentmc.org")
maven("https://repo.nyon.dev/releases")
maven("https://maven.isxander.dev/releases")
maven("https://maven.isxander.dev/snapshots")
maven("https://jitpack.io")
}

dependencies {
minecraft("com.mojang:minecraft:$mcVersion")
mappings(loom.layered {
val parchment: String = property("deps.parchment").toString()
if (parchment.isNotEmpty()) parchment("org.parchmentmc.data:parchment-$parchment@zip")
officialMojangMappings()
})

implementation("org.vineflower:vineflower:1.10.1")
modImplementation("net.fabricmc:fabric-loader:0.15.11")
modImplementation("net.fabricmc.fabric-api:fabric-api:${property("deps.fapi")!!}")
modImplementation("net.fabricmc:fabric-language-kotlin:1.11.0+kotlin.2.0.0")

modImplementation("dev.isxander:yet-another-config-lib:${property("deps.yacl")!!}")
modImplementation("com.terraformersmc:modmenu:${property("deps.modMenu")!!}")

include(implementation(annotationProcessor("com.github.bawnorton.mixinsquared:mixinsquared-fabric:0.1.1")!!)!!)

include(modImplementation("dev.nyon:konfig:2.0.1-1.20.4")!!)
}

val javaVersion = property("javaVer")!!.toString()
tasks {
processResources {
val modId = "telekinesis"
val modName = "telekinesis"
val modDescription = "Adds a telekinesis enchantment to minecraft"

val props = mapOf(
"id" to modId,
"name" to modName,
"description" to modDescription,
"version" to project.version,
"github" to githubRepo,
"mc" to mcVersionRange
)

props.forEach(inputs::property)

filesMatching("fabric.mod.json") {
expand(props)
}
}

register("releaseMod") {
group = "publishing"

dependsOn("publishMods")
dependsOn("publish")
}

withType<JavaCompile> {
options.release = javaVersion.toInt()
}

withType<KotlinCompile> {
compilerOptions {
jvmTarget = JvmTarget.fromTarget(javaVersion)
}
}
}

val changelogText = buildString {
append("# v${project.version}\n")
rootProject.file("changelog.md").readText().also(::append)
}

val supportedMcVersions: List<String> =
property("supportedMcVersions")!!.toString().split(',').map(String::trim).filter(String::isNotEmpty)

publishMods {
displayName = "v${project.version}"
file = tasks.remapJar.get().archiveFile
changelog = changelogText
type = if (beta != null) BETA else STABLE
modLoaders.addAll("fabric", "quilt")

modrinth {
projectId = "LLfA8jAD"
accessToken = providers.environmentVariable("MODRINTH_API_KEY")
minecraftVersions.addAll(supportedMcVersions)

requires { slug = "fabric-api" }
requires { slug = "yacl" }
requires { slug = "fabric-language-kotlin" }
optional { slug = "modmenu" }
}

github {
repository = githubRepo
accessToken = providers.environmentVariable("GITHUB_TOKEN")
commitish = "master"
}
}

publishing {
repositories {
maven {
name = "nyon"
url = uri("https://repo.nyon.dev/releases")
credentials {
username = providers.environmentVariable("NYON_USERNAME").orNull
password = providers.environmentVariable("NYON_PASSWORD").orNull
}
}
}
publications {
create<MavenPublication>("maven") {
groupId = "dev.nyon"
artifactId = "telekinesis"
version = project.version.toString()
from(components["java"])
}
}
}

java {
withSourcesJar()

javaVersion.toInt().let { JavaVersion.values()[it - 1] }.let {
sourceCompatibility = it
targetCompatibility = it
}
}

/*
signing {
val signingKey: String? by project
val signingPassword: String? by project
useGpgCmd()
if (signingKey != null && signingPassword != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign(publishing.publications)
}
*/

Loading
Loading