Update mcstructs and use new component serializer

This commit is contained in:
FlorianMichael 2024-04-21 12:13:59 +02:00
parent bd3f1206e6
commit dc6d581123
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
4 changed files with 7 additions and 6 deletions

View File

@ -370,7 +370,7 @@ public class ComponentRewriter1_20_5 extends ComponentRewriter<ClientboundPacket
predicateTag.put("state", state);
}
if (predicate.tag() != null) {
predicateTag.putString("nbt", SerializerVersion.V1_20_3.toSNBT(predicate.tag()));
predicateTag.putString("nbt", serializerVersion().toSNBT(predicate.tag()));
}
predicates.add(predicateTag);
@ -1045,7 +1045,7 @@ public class ComponentRewriter1_20_5 extends ComponentRewriter<ClientboundPacket
}
public SerializerVersion serializerVersion() {
return SerializerVersion.V1_20_3;
return SerializerVersion.V1_20_5;
}
@FunctionalInterface

View File

@ -94,7 +94,7 @@ public final class ComponentUtil {
public static @Nullable String tagToJsonString(@Nullable final Tag tag) {
try {
final ATextComponent component = SerializerVersion.V1_20_3.toComponent(tag);
final ATextComponent component = SerializerVersion.V1_20_5.toComponent(tag);
return component != null ? SerializerVersion.V1_20_3.toString(component) : null;
} catch (final Exception e) {
Via.getPlatform().getLogger().log(Level.SEVERE, "Error converting tag: " + tag, e);
@ -109,7 +109,7 @@ public final class ComponentUtil {
try {
final ATextComponent component = TextComponentSerializer.V1_20_3.deserialize(json);
return SerializerVersion.V1_20_3.toTag(component);
return SerializerVersion.V1_20_5.toTag(component);
} catch (final Exception e) {
Via.getPlatform().getLogger().log(Level.SEVERE, "Error converting component: " + json, e);
return new StringTag("<error>");

View File

@ -39,7 +39,8 @@ public enum SerializerVersion {
V1_17(TextComponentSerializer.V1_17, SNbtSerializer.V1_14),
V1_18(TextComponentSerializer.V1_18, SNbtSerializer.V1_14),
V1_19_4(TextComponentSerializer.V1_19_4, SNbtSerializer.V1_14),
V1_20_3(TextComponentCodec.V1_20_3, SNbtSerializer.V1_14);
V1_20_3(TextComponentCodec.V1_20_3, SNbtSerializer.V1_14),
V1_20_5(TextComponentCodec.V1_20_5, SNbtSerializer.V1_14);
final TextComponentSerializer jsonSerializer;
final SNbtSerializer<? extends Tag> snbtSerializer;

View File

@ -5,7 +5,7 @@ metadata.format.version = "1.1"
gson = "2.10.1"
fastutil = "8.5.12"
vianbt = "4.4.3"
mcstructs = "2.4.2"
mcstructs = "2.5.0-SNAPSHOT"
# Common provided
netty = "4.0.20.Final"