package protocolsupport.protocol.packet.middleimpl.clientbound.play.v_13;

import protocolsupport.protocol.ConnectionImpl;
import protocolsupport.protocol.packet.ClientBoundPacket;
import protocolsupport.protocol.packet.middle.clientbound.play.MiddleCustomPayload;
import protocolsupport.protocol.packet.middleimpl.ClientBoundPacketData;
import protocolsupport.protocol.serializer.StringSerializer;
import protocolsupport.utils.recyclable.RecyclableCollection;
import protocolsupport.utils.recyclable.RecyclableSingletonList;

public class CustomPayload extends MiddleCustomPayload {

	public CustomPayload(ConnectionImpl connection) {
		super(connection);
	}

	@Override
	public RecyclableCollection<ClientBoundPacketData> toData() {
		ClientBoundPacketData serializer = ClientBoundPacketData.create(ClientBoundPacket.PLAY_CUSTOM_PAYLOAD_ID);
		StringSerializer.writeString(serializer, connection.getVersion(), tag);
		serializer.writeBytes(data);
		return RecyclableSingletonList.create(serializer);
	}

}

@@ -374,30 +374,243 @@
 ializer.
-StringSerializ
+MerchantDataSerializer;%0Aimport protocolsupport.protocol.serializer.StringSerializer;%0Aimport protocolsupport.protocol.typeremapper.legacy.LegacyCustomPayloadChannelName;%0Aimport protocolsupport.protocol.utils.ProtocolVersionsHelp
 er;%0Aimpo
@@ -1124,16 +1124,384 @@
 , tag);%0A
+%09%09switch (tag) %7B%0A%09%09%09case (LegacyCustomPayloadChannelName.MODERN_TRADER_LIST): %7B%0A%09%09%09%09String locale = cache.getAttributesCache().getLocale();%0A%09%09%09%09MerchantDataSerializer.writeMerchantData(%0A%09%09%09%09%09serializer, connection.getVersion(), locale,%0A%09%09%09%09%09MerchantDataSerializer.readMerchantData(data, ProtocolVersionsHelper.LATEST_PC, locale)%0A%09%09%09%09);%0A%09%09%09%09break;%0A%09%09%09%7D%0A%09%09%09default: %7B%0A%09%09
 %09%09serial
@@ -1523,16 +1523,36 @@
 (data);%0A
+%09%09%09%09break;%0A%09%09%09%7D%0A%09%09%7D%0A
 %09%09return

Fix traders in 1.13 and 1.13.1