Fix quotation marks appearing in mixed json arrays

Fixes #3572
This commit is contained in:
Nassim Jahnke 2023-12-10 10:58:44 +01:00
parent ec2397472d
commit 1656ad45a0
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
2 changed files with 6 additions and 6 deletions

View File

@ -408,7 +408,7 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
addComponentType(jsonObject, tag);
return tag;
} else if (element.isJsonArray()) {
return convertJsonArray(element);
return convertJsonArray(element.getAsJsonArray());
} else if (element.isJsonPrimitive()) {
final JsonPrimitive primitive = element.getAsJsonPrimitive();
if (primitive.isString()) {
@ -461,11 +461,11 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
}
}
private static ListTag convertJsonArray(final JsonElement element) {
private static ListTag convertJsonArray(final JsonArray array) {
// TODO Number arrays?
final ListTag listTag = new ListTag();
boolean singleType = true;
for (final JsonElement entry : element.getAsJsonArray()) {
for (final JsonElement entry : array) {
final Tag convertedEntryTag = convertToTag(entry);
if (listTag.getElementType() != null && listTag.getElementType() != convertedEntryTag.getClass()) {
singleType = false;
@ -482,7 +482,7 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
// Generally, vanilla-esque serializers should not produce this format, so it should be rare
// Lists are only used for lists of components ("extra" and "with")
final ListTag processedListTag = new ListTag();
for (final JsonElement entry : element.getAsJsonArray()) {
for (final JsonElement entry : array) {
final Tag convertedTag = convertToTag(entry);
if (convertedTag instanceof CompoundTag) {
processedListTag.add(convertedTag);
@ -496,7 +496,7 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
compoundTag.put("text", new StringTag());
compoundTag.put("extra", convertedTag);
} else {
compoundTag.put("text", new StringTag(convertedTag.toString()));
compoundTag.put("text", new StringTag(convertedTag.asRawString()));
}
processedListTag.add(compoundTag);
}

View File

@ -6,7 +6,7 @@ adventure = "4.14.0"
gson = "2.10.1"
fastutil = "8.5.12"
flare = "2.0.1"
vianbt = "3.2.1"
vianbt = "3.3.0"
# Common provided
netty = "4.0.20.Final"