mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-12-18 16:17:45 +01:00
Fix wrong Protocol1_8To1_9#STRING_TO_JSON usages in 1.12->1.11.1 (#746)
This commit is contained in:
parent
903a49b96a
commit
4d6c6a2da1
@ -30,12 +30,12 @@ import com.viaversion.viaversion.api.minecraft.ClientWorld;
|
|||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_12;
|
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_12;
|
||||||
import com.viaversion.viaversion.api.type.Types;
|
import com.viaversion.viaversion.api.type.Types;
|
||||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||||
import com.viaversion.viaversion.libs.gson.JsonElement;
|
|
||||||
import com.viaversion.viaversion.protocols.v1_11_1to1_12.packet.ClientboundPackets1_12;
|
import com.viaversion.viaversion.protocols.v1_11_1to1_12.packet.ClientboundPackets1_12;
|
||||||
import com.viaversion.viaversion.protocols.v1_11_1to1_12.packet.ServerboundPackets1_12;
|
import com.viaversion.viaversion.protocols.v1_11_1to1_12.packet.ServerboundPackets1_12;
|
||||||
import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.packet.ClientboundPackets1_9_3;
|
import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.packet.ClientboundPackets1_9_3;
|
||||||
import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.packet.ServerboundPackets1_9_3;
|
import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.packet.ServerboundPackets1_9_3;
|
||||||
import com.viaversion.viaversion.protocols.v1_8to1_9.Protocol1_8To1_9;
|
import com.viaversion.viaversion.util.ComponentUtil;
|
||||||
|
import com.viaversion.viaversion.util.SerializerVersion;
|
||||||
|
|
||||||
public class Protocol1_12To1_11_1 extends BackwardsProtocol<ClientboundPackets1_12, ClientboundPackets1_9_3, ServerboundPackets1_12, ServerboundPackets1_9_3> {
|
public class Protocol1_12To1_11_1 extends BackwardsProtocol<ClientboundPackets1_12, ClientboundPackets1_9_3, ServerboundPackets1_12, ServerboundPackets1_9_3> {
|
||||||
|
|
||||||
@ -57,8 +57,9 @@ public class Protocol1_12To1_11_1 extends BackwardsProtocol<ClientboundPackets1_
|
|||||||
registerClientbound(ClientboundPackets1_12.SET_TITLES, wrapper -> {
|
registerClientbound(ClientboundPackets1_12.SET_TITLES, wrapper -> {
|
||||||
int action = wrapper.passthrough(Types.VAR_INT);
|
int action = wrapper.passthrough(Types.VAR_INT);
|
||||||
if (action >= 0 && action <= 2) {
|
if (action >= 0 && action <= 2) {
|
||||||
JsonElement component = wrapper.read(Types.COMPONENT);
|
// Should be done globally in the component rewriter, but /shrug for now
|
||||||
wrapper.write(Types.COMPONENT, Protocol1_8To1_9.STRING_TO_JSON.transform(wrapper, component.toString()));
|
String component = wrapper.read(Types.COMPONENT).toString();
|
||||||
|
wrapper.write(Types.COMPONENT, ComponentUtil.convertJsonOrEmpty(component, SerializerVersion.V1_12, SerializerVersion.V1_9));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ import com.viaversion.viaversion.api.connection.UserConnection;
|
|||||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||||
import com.viaversion.viaversion.api.type.Types;
|
import com.viaversion.viaversion.api.type.Types;
|
||||||
import com.viaversion.viaversion.protocols.v1_11_1to1_12.packet.ClientboundPackets1_12;
|
import com.viaversion.viaversion.protocols.v1_11_1to1_12.packet.ClientboundPackets1_12;
|
||||||
import com.viaversion.viaversion.protocols.v1_8to1_9.Protocol1_8To1_9;
|
import com.viaversion.viaversion.util.ComponentUtil;
|
||||||
import com.viaversion.viaversion.util.Key;
|
import com.viaversion.viaversion.util.Key;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
@ -39,10 +39,10 @@ public class ShoulderTracker extends StoredObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void update() {
|
public void update() {
|
||||||
PacketWrapper wrapper = PacketWrapper.create(ClientboundPackets1_12.CHAT, null, getUser());
|
PacketWrapper wrapper = PacketWrapper.create(ClientboundPackets1_12.CHAT, getUser());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
wrapper.write(Types.COMPONENT, Protocol1_8To1_9.STRING_TO_JSON.transform(wrapper, generateString()));
|
wrapper.write(Types.COMPONENT, ComponentUtil.plainToJson(generateString()));
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user