Skip to content

Commit a36341e

Browse files
committed
Update to Minecraft 1.21.8
1 parent ebe2442 commit a36341e

File tree

4 files changed

+25
-13
lines changed

4 files changed

+25
-13
lines changed

fabric/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'fabric-loom' version '1.9.2'
2+
id 'fabric-loom' version '1.11-SNAPSHOT'
33
id 'com.gradleup.shadow' version '8.3.5'
44
}
55

@@ -9,10 +9,10 @@ java {
99
}
1010

1111
ext {
12-
minecraft_version = '1.21.4'
13-
yarn_mappings = '1.21.4+build.8'
14-
loader_version = '0.16.14'
15-
fabric_version = '0.119.3+1.21.4'
12+
minecraft_version = '1.21.8'
13+
yarn_mappings = '1.21.8+build.1'
14+
loader_version = '0.17.2'
15+
fabric_version = '0.132.0+1.21.8'
1616
}
1717

1818
dependencies {

fabric/src/main/java/com/azuriom/azlink/fabric/command/TextAdapter.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package com.azuriom.azlink.fabric.command;
22

3-
import com.google.gson.JsonElement;
3+
import com.google.gson.JsonParseException;
4+
import com.mojang.serialization.JsonOps;
45
import net.kyori.adventure.text.TextComponent;
56
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
67
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
78
import net.minecraft.registry.DynamicRegistryManager;
89
import net.minecraft.text.Text;
10+
import net.minecraft.text.TextCodecs;
911

1012
public final class TextAdapter {
1113

@@ -20,8 +22,12 @@ private TextAdapter() {
2022

2123
public static Text toText(String message) {
2224
TextComponent component = LEGACY_SERIALIZER.deserialize(message);
23-
JsonElement json = GsonComponentSerializer.gson().serializeToTree(component);
2425

25-
return Text.Serialization.fromJsonTree(json, DynamicRegistryManager.EMPTY);
26+
// Code from LuckPerms, under MIT License
27+
// https://github.com/LuckPerms/LuckPerms
28+
return TextCodecs.CODEC.decode(
29+
DynamicRegistryManager.EMPTY.getOps(JsonOps.INSTANCE),
30+
GsonComponentSerializer.gson().serializeToTree(component)
31+
).getOrThrow(JsonParseException::new).getFirst();
2632
}
2733
}

neoforge/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ java {
99
}
1010

1111
ext {
12-
minecraft_version = '1.21.4'
13-
neo_version = '21.4.10-beta'
12+
minecraft_version = '1.21.8'
13+
neo_version = '21.8.4-beta'
1414
}
1515

1616
neoForge {

neoforge/src/main/java/com/azuriom/azlink/neoforge/command/ComponentAdapter.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package com.azuriom.azlink.neoforge.command;
22

3-
import com.google.gson.JsonElement;
3+
import com.mojang.serialization.JsonOps;
44
import net.kyori.adventure.text.TextComponent;
55
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
66
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
77
import net.minecraft.core.RegistryAccess;
88
import net.minecraft.network.chat.Component;
9+
import net.minecraft.network.chat.ComponentSerialization;
910

1011
public final class ComponentAdapter {
1112

@@ -20,7 +21,12 @@ private ComponentAdapter() {
2021

2122
public static Component toComponent(String message) {
2223
TextComponent component = LEGACY_SERIALIZER.deserialize(message);
23-
JsonElement json = GsonComponentSerializer.gson().serializeToTree(component);
2424

25-
return Component.Serializer.fromJson(json, RegistryAccess.EMPTY); }
25+
// Code from LuckPerms, under MIT License
26+
// https://github.com/LuckPerms/LuckPerms
27+
return ComponentSerialization.CODEC.decode(
28+
RegistryAccess.EMPTY.createSerializationContext(JsonOps.INSTANCE),
29+
GsonComponentSerializer.gson().serializeToTree(component)
30+
).getOrThrow(IllegalArgumentException::new).getFirst();
31+
}
2632
}

0 commit comments

Comments
 (0)