Skip to content

Commit

Permalink
Fix traders in 1.13 and 1.13.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Brokkonaut committed Oct 23, 2018
1 parent ef0a484 commit b3eca2d
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
import protocolsupport.protocol.packet.ClientBoundPacket;
import protocolsupport.protocol.packet.middle.clientbound.play.MiddleCustomPayload;
import protocolsupport.protocol.packet.middleimpl.ClientBoundPacketData;
import protocolsupport.protocol.serializer.MerchantDataSerializer;
import protocolsupport.protocol.serializer.StringSerializer;
import protocolsupport.protocol.typeremapper.legacy.LegacyCustomPayloadChannelName;
import protocolsupport.protocol.utils.ProtocolVersionsHelper;
import protocolsupport.utils.recyclable.RecyclableCollection;
import protocolsupport.utils.recyclable.RecyclableSingletonList;

Expand All @@ -18,7 +21,20 @@ public CustomPayload(ConnectionImpl connection) {
public RecyclableCollection<ClientBoundPacketData> toData() {
ClientBoundPacketData serializer = ClientBoundPacketData.create(ClientBoundPacket.PLAY_CUSTOM_PAYLOAD_ID);
StringSerializer.writeString(serializer, connection.getVersion(), tag);
serializer.writeBytes(data);
switch (tag) {
case (LegacyCustomPayloadChannelName.MODERN_TRADER_LIST): {
String locale = cache.getAttributesCache().getLocale();
MerchantDataSerializer.writeMerchantData(
serializer, connection.getVersion(), locale,
MerchantDataSerializer.readMerchantData(data, ProtocolVersionsHelper.LATEST_PC, locale)
);
break;
}
default: {
serializer.writeBytes(data);
break;
}
}
return RecyclableSingletonList.create(serializer);
}

Expand Down

0 comments on commit b3eca2d

Please sign in to comment.