Skip to content

Commit c6df9f0

Browse files
committed
1.21.9/10 support
1 parent cc6e38c commit c6df9f0

File tree

8 files changed

+45
-25
lines changed

8 files changed

+45
-25
lines changed

.github/workflows/build-gradle.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,12 @@ jobs:
214214
fabric
215215
216216
game-versions: |
217-
1.21.4
218217
1.21.5
219218
1.21.6
220219
1.21.7
221220
1.21.8
221+
1.21.9
222+
1.21.10
222223
223224
retry-attempts: 2
224225
retry-delay: 10000

build.gradle.kts

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,30 @@ import java.io.ByteArrayOutputStream
33
plugins {
44
id("java")
55
id("com.gradleup.shadow") version "8.3.3" apply false
6-
id("fabric-loom") version "1.10.5" apply false
6+
id("fabric-loom") version "1.11.8" apply false
7+
}
8+
9+
fun getGitCommitHash(project: Project): String? {
10+
// Only try to get the hash if the .git directory exists
11+
if (!project.file(".git").isDirectory) {
12+
return null
13+
}
14+
return try {
15+
val process = ProcessBuilder("git", "rev-parse", "--short", "HEAD")
16+
.redirectOutput(ProcessBuilder.Redirect.PIPE)
17+
.redirectError(ProcessBuilder.Redirect.PIPE)
18+
.start()
19+
20+
process.waitFor(5, TimeUnit.SECONDS)
21+
22+
if (process.exitValue() == 0) {
23+
process.inputStream.bufferedReader().readText().trim().takeIf { it.isNotEmpty() }
24+
} else {
25+
null
26+
}
27+
} catch (e: Exception) {
28+
null
29+
}
730
}
831

932
val fullVersion = "1.3.5"
@@ -23,14 +46,10 @@ allprojects {
2346
if (!snapshot) {
2447
return ""
2548
}
26-
var commitHash = ""
27-
if (includeHash && file(".git").isDirectory) {
28-
val stdout = ByteArrayOutputStream()
29-
exec {
30-
commandLine("git", "rev-parse", "--short", "HEAD")
31-
standardOutput = stdout
32-
}
33-
commitHash = "+${stdout.toString().trim()}"
49+
val commitHash = if (includeHash) {
50+
getGitCommitHash(project)?.let { "+$it" } ?: ""
51+
} else {
52+
""
3453
}
3554
return "$commitHash-SNAPSHOT"
3655
}

bukkit/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ dependencies {
4040

4141
shadeThisThing(implementation("org.kohsuke:github-api:1.326")!!)
4242
if (shadePE) {
43-
shadeThisThing(implementation("com.github.retrooper:packetevents-spigot:2.9.5-SNAPSHOT")!!)
43+
shadeThisThing(implementation("com.github.retrooper:packetevents-spigot:2.10.1-SNAPSHOT")!!)
4444
} else {
45-
compileOnly("com.github.retrooper:packetevents-spigot:2.9.5-SNAPSHOT")
45+
compileOnly("com.github.retrooper:packetevents-spigot:2.10.1-SNAPSHOT")
4646
}
47-
shadeThisThing(implementation("org.incendo:cloud-paper:2.0.0-beta.10")!!)
47+
shadeThisThing(implementation("org.incendo:cloud-paper:2.0.0-beta.13")!!)
4848
shadeThisThing(implementation("org.incendo:cloud-core:2.0.0")!!)
4949

5050
// Required for 1.14.4 support because gson is too old to have JosnParser.parseString()

common/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ dependencies {
1313

1414
// Shaded in or bundled by platform-specific code
1515
if (shadePE) {
16-
implementation("com.github.retrooper:packetevents-api:2.9.5-SNAPSHOT")
16+
implementation("com.github.retrooper:packetevents-api:2.10.1-SNAPSHOT")
1717
} else {
18-
compileOnly("com.github.retrooper:packetevents-api:2.9.5-SNAPSHOT")
18+
compileOnly("com.github.retrooper:packetevents-api:2.10.1-SNAPSHOT")
1919
}
2020

2121
implementation("org.yaml:snakeyaml:2.0")

fabric/build.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ dependencies {
3939
modImplementation(fabricApi.module("fabric-events-interaction-v0", "${rootProject.property("fabric_version")}"))
4040

4141
include(modImplementation("me.lucko:fabric-permissions-api:0.3.1")!!)
42-
include(modImplementation("com.github.retrooper:packetevents-fabric:2.9.5-SNAPSHOT")!!)
43-
include(modImplementation("org.incendo:cloud-fabric:2.0.0-beta.10")!!)
42+
include(modImplementation("com.github.retrooper:packetevents-fabric:2.10.1-SNAPSHOT")!!)
43+
include(modImplementation("org.incendo:cloud-fabric:2.0.0-beta.13")!!)
4444

4545
include(implementation("org.incendo:cloud-minecraft-extras:2.0.0-beta.10")!!)
4646
include(implementation("org.yaml:snakeyaml:2.0")!!)
@@ -70,8 +70,8 @@ tasks.processResources {
7070
filesMatching("fabric.mod.json") {
7171
expand(
7272
"version" to project.version,
73-
"minecraft_version" to rootProject.property("minecraft_version"),
74-
"loader_version" to rootProject.property("loader_version")
73+
"minecraft_version" to rootProject.property("minecraft_version")!!,
74+
"loader_version" to rootProject.property("loader_version")!!
7575
)
7676
}
7777
}

fabric/src/main/java/me/caseload/knockbacksync/player/FabricPlayer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public boolean isGliding() {
9191

9292
@Override
9393
public PlatformWorld getWorld() {
94-
return new FabricWorld(fabricPlayer.getWorld());
94+
return new FabricWorld(fabricPlayer.getEntityWorld());
9595
}
9696

9797
@Override
@@ -117,7 +117,7 @@ public boolean isSprinting() {
117117

118118
@Override
119119
public int getMainHandKnockbackLevel() {
120-
RegistryEntry<Enchantment> knockbackEntry = fabricPlayer.getWorld().getRegistryManager().getOrThrow(RegistryKeys.ENCHANTMENT).getOrThrow(Enchantments.KNOCKBACK);
120+
RegistryEntry<Enchantment> knockbackEntry = fabricPlayer.getEntityWorld().getRegistryManager().getOrThrow(RegistryKeys.ENCHANTMENT).getOrThrow(Enchantments.KNOCKBACK);
121121
return EnchantmentHelper.getLevel(knockbackEntry, fabricPlayer.getMainHandStack());
122122
}
123123

fabric/src/main/java/me/caseload/knockbacksync/util/CustomUpdateIntervals.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static void updateIntervals(ServerWorld level, Map<String, Integer> entit
2929
for (Entity entity : level.iterateEntities()) {
3030
String entityType = entity.getType().getRegistryEntry().getIdAsString();
3131
if (entityIntervals.containsKey(entityType)) {
32-
ServerChunkLoadingManager.EntityTracker serverEntity = ((ServerChunkManager) entity.getWorld().getChunkManager()).chunkLoadingManager.entityTrackers.get(entity.getId());
32+
ServerChunkLoadingManager.EntityTracker serverEntity = ((ServerChunkManager) entity.getEntityWorld().getChunkManager()).chunkLoadingManager.entityTrackers.get(entity.getId());
3333
if (serverEntity != null) {
3434
((UpdateIntervalAccessor) serverEntity).setUpdateInterval(entityIntervals.get(entityType));
3535
}

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ org.gradle.parallel=true
44

55
# Fabric Properties
66
# check these on https://modmuss50.me/fabric.html
7-
minecraft_version=1.21.6
8-
yarn_mappings=1.21.6+build.1:v2
7+
minecraft_version=1.21.10
8+
yarn_mappings=1.21.10+build.2:v2
99
loader_version=0.16.13
1010

1111
# Mod Properties
@@ -14,6 +14,6 @@ archives_base_name=knockbacksync
1414

1515
# Dependencies
1616
# check this on https://modmuss50.me/fabric.html
17-
fabric_version=0.128.1+1.21.6
17+
fabric_version=0.138.3+1.21.10
1818

1919
githubRepo=CASELOAD7000/knockback-sync

0 commit comments

Comments
 (0)