Skip to content

Commit bce1c49

Browse files
Adding packets for eating and drinking
1 parent 5bbd810 commit bce1c49

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/net/incoming-packet-directory.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const packets: { [key: number]: incomingPacket } = {
5252
228: itemInteractionPacket,
5353
26: itemInteractionPacket,
5454
147: itemInteractionPacket,
55+
240: itemInteractionPacket,
5556
29: dropItemPacket,
5657
85: pickupItemPacket,
5758

src/net/incoming-packets/item-interaction-packet.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ const option4 = (packet: ByteBuffer): ItemInteraction => {
4343
return { widgetId, containerId, itemId, slot };
4444
};
4545

46+
const inventoryOption1 = (packet: ByteBuffer): ItemInteraction => {
47+
const slot = packet.get('SHORT', 'UNSIGNED', 'LITTLE_ENDIAN');
48+
const itemId = packet.get('SHORT', 'SIGNED', 'LITTLE_ENDIAN');
49+
const containerId = packet.get('SHORT', 'SIGNED', 'LITTLE_ENDIAN');
50+
const widgetId = packet.get('SHORT', 'UNSIGNED');
51+
return { widgetId, containerId, itemId, slot };
52+
};
53+
4654
const inventoryOption4 = (packet: ByteBuffer): ItemInteraction => {
4755
const slot = packet.get('SHORT', 'UNSIGNED');
4856
const widgetId = packet.get('SHORT', 'SIGNED', 'LITTLE_ENDIAN');
@@ -58,6 +66,7 @@ export const itemInteractionPacket: incomingPacket = (player: Player, packetId:
5866
26: { packetDef: option3, optionNumber: 3 },
5967
147: { packetDef: option4, optionNumber: 4 },
6068
98: { packetDef: inventoryOption4, optionNumber: 4 },
69+
240: { packetDef: inventoryOption1, optionNumber: 1 },
6170
};
6271

6372
const packetDetails = packets[packetId];

0 commit comments

Comments
 (0)