@nxg-org/mineflayer-util-plugin 1.8.3 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -25,6 +25,7 @@ export declare class InventoryFunctions {
|
|
|
25
25
|
get equippingMainHand(): boolean;
|
|
26
26
|
set equippingOffHand(value: boolean);
|
|
27
27
|
get equippingOffHand(): boolean;
|
|
28
|
+
get equipmentSlots(): EquipmentDestination[];
|
|
28
29
|
getAllItems(): Item[];
|
|
29
30
|
getAllItemsExceptCurrent(current: EquipmentDestination): Item[];
|
|
30
31
|
getHandWithItem(offhand?: boolean): Item | null;
|
|
@@ -62,16 +62,23 @@ class InventoryFunctions {
|
|
|
62
62
|
get equippingOffHand() {
|
|
63
63
|
return this._equippingOffHand;
|
|
64
64
|
}
|
|
65
|
+
get equipmentSlots() {
|
|
66
|
+
const ret = ["hand", "head", "torso", "legs", "feet"];
|
|
67
|
+
if (!this.bot.supportFeature('doesntHaveOffHandSlot')) {
|
|
68
|
+
ret.push("off-hand");
|
|
69
|
+
}
|
|
70
|
+
return ret;
|
|
71
|
+
}
|
|
65
72
|
getAllItems() {
|
|
66
73
|
return [
|
|
67
74
|
...this.bot.inventory.items(),
|
|
68
|
-
...
|
|
75
|
+
...this.equipmentSlots.map((name) => this.bot.inventory.slots[this.bot.getEquipmentDestSlot(name)]),
|
|
69
76
|
].filter((e) => !!e);
|
|
70
77
|
}
|
|
71
78
|
getAllItemsExceptCurrent(current) {
|
|
72
79
|
return [
|
|
73
80
|
...this.bot.inventory.items(),
|
|
74
|
-
...(
|
|
81
|
+
...(this.equipmentSlots
|
|
75
82
|
.filter((name) => name !== current))
|
|
76
83
|
.map((name) => this.bot.inventory.slots[this.bot.getEquipmentDestSlot(name)]),
|
|
77
84
|
].filter((e) => !!e);
|