diff --git a/api/src/main/java/com/viaversion/viaversion/api/protocol/version/ProtocolVersion.java b/api/src/main/java/com/viaversion/viaversion/api/protocol/version/ProtocolVersion.java index fe09bbc19..b43d9a023 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/protocol/version/ProtocolVersion.java +++ b/api/src/main/java/com/viaversion/viaversion/api/protocol/version/ProtocolVersion.java @@ -82,7 +82,7 @@ public class ProtocolVersion { public static final ProtocolVersion v1_19 = register(759, "1.19"); public static final ProtocolVersion v1_19_1 = register(760, "1.19.1/2", new VersionRange("1.19", 1, 2)); public static final ProtocolVersion v1_19_3 = register(761, "1.19.3"); - public static final ProtocolVersion v1_19_4 = register(762, 125, "1.19.4"); + public static final ProtocolVersion v1_19_4 = register(762, 126, "1.19.4"); public static final ProtocolVersion unknown = register(-1, "UNKNOWN"); public static ProtocolVersion register(int version, String name) { diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/Position1_14Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/Position1_14Type.java index b2d447d89..cfec06c82 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/Position1_14Type.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/Position1_14Type.java @@ -50,6 +50,11 @@ public class Position1_14Type extends Type { | ((((long) object.z()) & 0x3ffffff) << 12)); } + @Override + public Class getBaseClass() { + return PositionType.class; + } + public static final class OptionalPosition1_14Type extends OptionalType { public OptionalPosition1_14Type() { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19_4to1_19_3/Protocol1_19_4To1_19_3.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19_4to1_19_3/Protocol1_19_4To1_19_3.java index 4d21470f6..29ae5e2e4 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19_4to1_19_3/Protocol1_19_4To1_19_3.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_19_4to1_19_3/Protocol1_19_4To1_19_3.java @@ -18,7 +18,6 @@ package com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3; import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.entities.Entity1_19_4Types; import com.viaversion.viaversion.api.protocol.AbstractProtocol; @@ -27,6 +26,8 @@ import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.minecraft.ParticleType; import com.viaversion.viaversion.api.type.types.version.Types1_19_4; import com.viaversion.viaversion.data.entity.EntityTrackerBase; +import com.viaversion.viaversion.libs.kyori.adventure.text.Component; +import com.viaversion.viaversion.libs.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.ClientboundPackets1_19_3; import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.ServerboundPackets1_19_3; import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.data.MappingData; @@ -41,6 +42,7 @@ import java.util.Base64; public final class Protocol1_19_4To1_19_3 extends AbstractProtocol { public static final MappingData MAPPINGS = new MappingData(); + private static final JsonElement EMPTY_COMPONENT = GsonComponentSerializer.gson().serializeToTree(Component.empty()); private final EntityPackets entityRewriter = new EntityPackets(this); private final InventoryPackets itemRewriter = new InventoryPackets(this); @@ -58,6 +60,7 @@ public final class Protocol1_19_4To1_19_3 extends AbstractProtocol(this) { @Override public void handleArgument(final PacketWrapper wrapper, final String argumentType) throws Exception { @@ -72,10 +75,11 @@ public final class Protocol1_19_4To1_19_3 extends AbstractProtocol { JsonElement element = wrapper.read(Type.OPTIONAL_COMPONENT); - if (element == null) { - element = new JsonObject(); + if (element != null) { + wrapper.write(Type.COMPONENT, element); + } else { + wrapper.write(Type.COMPONENT, EMPTY_COMPONENT); } - wrapper.write(Type.COMPONENT, element); final String iconBase64 = wrapper.read(Type.OPTIONAL_STRING); final byte[] iconBytes = iconBase64 != null ? Base64.getDecoder().decode(iconBase64.substring("data:image/png;base64,".length()).getBytes(StandardCharsets.UTF_8)) : null; diff --git a/gradle.properties b/gradle.properties index d2e83f921..401ac4648 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ # Project properties - we put these here so they can be modified without causing a recompile of the build scripts -projectVersion=4.6.0-1.19.4-rc2-SNAPSHOT +projectVersion=4.6.0-1.19.4-rc3-SNAPSHOT # Gradle properties org.gradle.daemon=true