Skip to content

Commit

Permalink
fix: update inventory types
Browse files Browse the repository at this point in the history
  • Loading branch information
G07cha committed Dec 18, 2023
1 parent 8be06ae commit 5eeafed
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/invUtil.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { StorageEvents } from "mineflayer";
import {
DESTINATIONS,
TypeDestination,
Expand All @@ -8,7 +9,7 @@ import { Item } from "prismarine-item";
import { Window } from "prismarine-windows";

export const findItemById = (
inventory: { slots: readonly Item[] },
inventory: Window<StorageEvents>,
itemId: number,
) => inventory.slots.find((item) => item && item.type === itemId);

Expand Down Expand Up @@ -53,7 +54,7 @@ export const isNewArmorBetter = (oldArmor: Item, newArmor: Item): boolean => {
export const equipped = (
inventory: Window,
supportsOffhand: boolean,
): readonly Item[] =>
): (Item | null)[] =>
inventory.slots
.slice(5, 9)
.concat(supportsOffhand ? [inventory.slots[45]] : []);

0 comments on commit 5eeafed

Please sign in to comment.