3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-19 14:30:16 +01:00

Update mcstructs and use new component serializer

Dieser Commit ist enthalten in:
FlorianMichael 2024-04-21 12:13:59 +02:00
Ursprung bd3f1206e6
Commit dc6d581123
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: C2FB87E71C425126
4 geänderte Dateien mit 7 neuen und 6 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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