humus-old/common/packets/trait-update-receptacle-item-full.packet.js
2019-10-09 03:39:22 -05:00

30 lines
558 B
JavaScript

import msgpack from 'msgpack-lite';
import {Packet} from '@avocado/net';
export class TraitUpdateReceptacleItemFullPacket extends Packet {
static pack(packet) {
const data = packet.data[1];
data.json = msgpack.encode(data.json);
return super.pack(packet);
}
static get schema() {
return {
...super.schema,
data: {
slotIndex: 'uint16',
json: 'buffer',
},
};
}
static unpack(packet) {
const data = super.unpack(packet);
data.json = msgpack.decode(data.json);
return data;
}
}