Skip to content

Commit

Permalink
1.20.5 (#12)
Browse files Browse the repository at this point in the history
* cleanup and update to 1.20.5 (does not work cause of fapi=

* add fabric to runtime to prevent crashes

* reformat code

* update versions, add editorconfig
  • Loading branch information
btwonion authored Apr 25, 2024
1 parent 6345906 commit fd0a317
Show file tree
Hide file tree
Showing 68 changed files with 697 additions and 861 deletions.
40 changes: 40 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# https://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
max_line_length = 140

end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{java,kt,kts,scala,rs,xml,kt.spec,kts.spec}]
indent_size = 4

[*.{kt,kts}]
ktlint_code_style = ktlint_official
ktlint_ignore_back_ticked_identifier = true
ij_kotlin_allow_trailing_comma_on_call_site = false
ij_kotlin_allow_trailing_comma = false

ktlint_standard = enabled

# Don't allow any wildcard imports
ij_kotlin_packages_to_use_import_on_demand = unset

# Prevent wildcard imports
ij_kotlin_name_count_to_use_star_import = 99
ij_kotlin_name_count_to_use_star_import_for_members = 99

[*.md]
trim_trailing_whitespace = false
max_line_length = unset

[gradle/verification-metadata.xml]
indent_size = 3

[*.yml]
ij_yaml_spaces_within_brackets = false
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
plugins {
kotlin("jvm") version "1.9.22"
kotlin("plugin.serialization") version "1.9.22"
kotlin("jvm") version "1.9.23"
kotlin("plugin.serialization") version "1.9.23"
id("com.modrinth.minotaur") version "2.8.7" apply (false)
id("com.github.breadmoirai.github-release") version "2.5.2" apply (false)

id("fabric-loom") version "1.5-SNAPSHOT" apply (false)
id("fabric-loom") version "1.6-SNAPSHOT" apply (false)

id("io.papermc.paperweight.userdev") version "1.5.5" apply (false)
}

repositories {
mavenCentral()
}
}
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- update to 1.20.5
- no config screen cause of yacl at the moment
3 changes: 0 additions & 3 deletions changelogs/fabric-2.1.0-1.20.md

This file was deleted.

2 changes: 0 additions & 2 deletions changelogs/fabric-2.1.1-1.20.md

This file was deleted.

8 changes: 0 additions & 8 deletions changelogs/fabric-2.2.0-1.20.md

This file was deleted.

5 changes: 0 additions & 5 deletions changelogs/fabric-2.2.1-1.20.1.md

This file was deleted.

2 changes: 0 additions & 2 deletions changelogs/fabric-2.2.2-1.20.1.md

This file was deleted.

4 changes: 0 additions & 4 deletions changelogs/fabric-2.3.0-1.20.1.md

This file was deleted.

3 changes: 0 additions & 3 deletions changelogs/fabric-2.3.1-1.20.1.md

This file was deleted.

5 changes: 0 additions & 5 deletions changelogs/fabric-2.3.1-1.20.md

This file was deleted.

2 changes: 0 additions & 2 deletions changelogs/fabric-2.3.2-1.20.md

This file was deleted.

5 changes: 0 additions & 5 deletions changelogs/fabric-2.3.3-1.20.3.md

This file was deleted.

2 changes: 0 additions & 2 deletions changelogs/fabric-2.3.3-1.20.md

This file was deleted.

2 changes: 0 additions & 2 deletions changelogs/fabric-2.3.4-1.20.4.md

This file was deleted.

3 changes: 0 additions & 3 deletions changelogs/fabric-2.3.5-1.20.4.md

This file was deleted.

3 changes: 0 additions & 3 deletions changelogs/fabric-2.4.0-1.20.4.md

This file was deleted.

2 changes: 0 additions & 2 deletions changelogs/paper-2.1.0-1.20.md

This file was deleted.

2 changes: 0 additions & 2 deletions changelogs/paper-2.1.1-1.20.1.md

This file was deleted.

4 changes: 0 additions & 4 deletions changelogs/paper-2.2.0-1.20.1.md

This file was deleted.

2 changes: 0 additions & 2 deletions changelogs/paper-2.3.0-1.20.1.md

This file was deleted.

2 changes: 0 additions & 2 deletions changelogs/paper-2.3.1-1.20.1.md

This file was deleted.

2 changes: 0 additions & 2 deletions changelogs/paper-2.3.2-1.20.1.md

This file was deleted.

2 changes: 0 additions & 2 deletions changelogs/paper-2.3.2-1.20.2.md

This file was deleted.

2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
61 changes: 34 additions & 27 deletions telekinesis-fabric/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
@file:Suppress("SpellCheckingInspection")

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.nio.file.Path
import kotlin.io.path.notExists
import kotlin.io.path.readText

plugins {
Expand All @@ -20,9 +18,9 @@ plugins {

group = "dev.nyon"
val majorVersion = "2.4.0"
val mcVersion = "1.20.4"
val supportedMcVersions = listOf("1.20.3", "1.20.4")
version = "$majorVersion-1.20.4"
val mcVersion = "1.20.5-pre4"
val supportedMcVersions = listOf(mcVersion)
version = "$majorVersion-$mcVersion"
description = "Adds a telekinesis enchantment to minecraft"
val projectAuthors = listOf("btwonion")
val githubRepo = "btwonion/telekinesis"
Expand All @@ -42,30 +40,33 @@ repositories {
maven("https://maven.parchmentmc.org/")
maven("https://jitpack.io")
maven("https://oss.sonatype.org/content/repositories/snapshots/")
maven("https://maven.isxander.dev/snapshots") // remove in stable release
}

dependencies {
minecraft("com.mojang:minecraft:$mcVersion")
mappings(loom.layered {
parchment("org.parchmentmc.data:parchment-1.20.3:2023.12.31@zip")
officialMojangMappings()
})
mappings(
loom.layered {
parchment("org.parchmentmc.data:parchment-1.20.4:2024.04.14@zip")
officialMojangMappings()
}
)
implementation("org.vineflower:vineflower:1.9.3")
modImplementation("net.fabricmc:fabric-loader:0.15.6")
modImplementation("net.fabricmc:fabric-language-kotlin:1.10.17+kotlin.1.9.22")
modImplementation("dev.isxander.yacl:yet-another-config-lib-fabric:3.3.1+1.20.4")
modImplementation("com.terraformersmc:modmenu:9.0.0-pre.1")
modImplementation("net.fabricmc:fabric-loader:0.15.10")
modImplementation("net.fabricmc:fabric-language-kotlin:1.10.19+kotlin.1.9.23")
modImplementation("dev.isxander.yacl:yet-another-config-lib-fabric:3.3.3+1.20.4+update.1.20.5-SNAPSHOT+update.1.20.5-SNAPSHOT")
modImplementation("com.terraformersmc:modmenu:10.0.0-alpha.3")

modRuntimeOnly("net.fabricmc.fabric-api:fabric-api:0.91.3+1.20.4") // Not necessary, just here for testing purposes
modRuntimeOnly("net.fabricmc.fabric-api:fabric-api:0.97.3+1.20.5")

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

include(implementation("com.akuleshov7:ktoml-core-jvm:0.5.1")!!)

// Integration
modCompileOnly("maven.modrinth:abooMhox:c2klaSgQ") // tree-harvester by ricksouth
modCompileOnly("maven.modrinth:MpzVLzy5:9kJblF2V") // better nether by quickueck
modCompileOnly("maven.modrinth:EFtixeiF:Gcai736Z") // levelz by Globox1997
// modCompileOnly("maven.modrinth:abooMhox:c2klaSgQ") // tree-harvester by ricksouth wait for 1.20.5
// modCompileOnly("maven.modrinth:MpzVLzy5:9kJblF2V") // better nether by quickueck wait for 1.20.5
// modCompileOnly("maven.modrinth:EFtixeiF:Gcai736Z") // levelz by Globox1997 wait for 1.20.5
}

tasks {
Expand Down Expand Up @@ -103,23 +104,29 @@ tasks {
}

withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
kotlinOptions.jvmTarget = "21"
}

withType<JavaCompile> {
options.release.set(17)
options.release.set(21)
}

loom {
accessWidenerPath = file("src/main/resources/telekinesis.accesswidener")
}
}

val changelogFile: Path = rootDir.toPath().resolve("changelogs/fabric-$version.md")
val changelogText = if (changelogFile.notExists()) "" else changelogFile.readText()
val projectVersionname = "fabric-${project.version}"
val changelogText =
buildString {
append("# v${project.version}\n")
rootDir.toPath().resolve("changelog.md").readText().also { append(it) }
}

modrinth {
token.set(findProperty("modrinth.token")?.toString())
projectId.set("LLfA8jAD")
versionNumber.set(projectVersionname)
versionName.set(projectVersionname)
versionNumber.set("v${project.version}")
versionName.set("v${project.version}")
versionType.set("release")
uploadFile.set(tasks["remapJar"])
gameVersions.set(supportedMcVersions)
Expand All @@ -139,8 +146,8 @@ githubRelease {
val (rowner, rrepo) = githubRepo.split("/")
owner = rowner
repo = rrepo
releaseName = projectVersionname
tagName = projectVersionname
releaseName = "v${project.version}"
tagName = "v${project.version}"
body = changelogText
targetCommitish = "master"
setReleaseAssets(tasks["remapJar"])
Expand Down Expand Up @@ -173,4 +180,4 @@ signing {

java {
withSourcesJar()
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package dev.nyon.telekinesis.mixins;

import com.llamalad7.mixinextras.injector.WrapWithCondition;
import dev.nyon.telekinesis.TelekinesisPolicy;
import dev.nyon.telekinesis.utils.TelekinesisUtils;
import net.minecraft.server.level.ServerPlayer;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import dev.nyon.telekinesis.utils.EntityUtils;
import net.minecraft.world.entity.animal.horse.AbstractChestedHorse;
import net.minecraft.world.level.ItemLike;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -23,17 +21,6 @@ public boolean redirectEquipmentDrop(
AbstractChestedHorse instance,
ItemLike item
) {
final var attacker = instance.getLastAttacker();
if (!(attacker instanceof ServerPlayer serverPlayer)) return true;

boolean hasTelekinesis = TelekinesisUtils.handleTelekinesis(TelekinesisPolicy.MobDrops,
serverPlayer,
serverPlayer.getMainHandItem(),
player -> {
if (!player.addItem(item.asItem()
.getDefaultInstance())) instance.spawnAtLocation(item);
});

return !hasTelekinesis;
return EntityUtils.spawnAtLocationInject(instance, item);
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package dev.nyon.telekinesis.mixins;

import com.llamalad7.mixinextras.injector.WrapWithCondition;
import dev.nyon.telekinesis.TelekinesisPolicy;
import dev.nyon.telekinesis.utils.TelekinesisUtils;
import net.minecraft.server.level.ServerPlayer;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import dev.nyon.telekinesis.utils.EntityUtils;
import net.minecraft.world.entity.animal.horse.AbstractHorse;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -23,16 +21,6 @@ public boolean redirectEquipmentDrop(
AbstractHorse instance,
ItemStack stack
) {
final var attacker = instance.getLastAttacker();
if (!(attacker instanceof ServerPlayer serverPlayer)) return true;

boolean hasTelekinesis = TelekinesisUtils.handleTelekinesis(TelekinesisPolicy.MobDrops,
serverPlayer,
serverPlayer.getMainHandItem(),
player -> {
if (!player.addItem(stack)) instance.spawnAtLocation(stack);
});

return !hasTelekinesis;
return EntityUtils.spawnAtLocationInject(instance, stack);
}
}
Loading

0 comments on commit fd0a317

Please sign in to comment.