Fix 1.19 -> 1.18.2 title translation: empty text edge case (#3115)

This commit is contained in:
RK_01 2022-09-02 16:00:45 +02:00 committed by GitHub
parent ce4f21b7d8
commit c96b2bd859
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -120,7 +120,8 @@ public final class Protocol1_19To1_18_2 extends AbstractProtocol<ClientboundPack
final PacketHandler titleHandler = wrapper -> {
final JsonElement component = wrapper.read(Type.COMPONENT);
if (!component.isJsonNull()) {
final boolean isEmpty = component.isJsonNull() || (component.isJsonArray() && component.getAsJsonArray().size() == 0);
if (!isEmpty) {
wrapper.write(Type.COMPONENT, component);
} else {
wrapper.write(Type.COMPONENT, GsonComponentSerializer.gson().serializeToTree(Component.empty()));