30 lines
558 B
JavaScript
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;
|
|
}
|
|
|
|
}
|