mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-04-29 19:44:53 +02:00
handle equipped armor fo inventory
This commit is contained in:
parent
cc6fc66be2
commit
ce5faa94aa
2 changed files with 20 additions and 2 deletions
|
@ -66,6 +66,23 @@ export const queryList = [
|
|||
else if (agent.bot.game.gameMode === 'creative') {
|
||||
res += '\n(You have infinite items in creative mode. You do not need to gather resources!!)';
|
||||
}
|
||||
|
||||
let helmet = bot.inventory.slots[5];
|
||||
let chestplate = bot.inventory.slots[6];
|
||||
let leggings = bot.inventory.slots[7];
|
||||
let boots = bot.inventory.slots[8];
|
||||
res += '\nWEARING: ';
|
||||
if (helmet)
|
||||
res += `\nHead: ${helmet.name}`;
|
||||
if (chestplate)
|
||||
res += `\nTorso: ${chestplate.name}`;
|
||||
if (leggings)
|
||||
res += `\nLegs: ${leggings.name}`;
|
||||
if (boots)
|
||||
res += `\nFeet: ${boots.name}`;
|
||||
if (!helmet && !chestplate && !leggings && !boots)
|
||||
res += 'None';
|
||||
|
||||
return pad(res);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -673,7 +673,7 @@ export async function equip(bot, itemName) {
|
|||
* @example
|
||||
* await skills.equip(bot, "iron_pickaxe");
|
||||
**/
|
||||
let item = bot.inventory.items().find(item => item.name === itemName);
|
||||
let item = bot.inventory.slots.find(slot => slot && slot.name === itemName);
|
||||
if (!item) {
|
||||
log(bot, `You do not have any ${itemName} to equip.`);
|
||||
return false;
|
||||
|
@ -687,12 +687,13 @@ export async function equip(bot, itemName) {
|
|||
else if (itemName.includes('helmet')) {
|
||||
await bot.equip(item, 'head');
|
||||
}
|
||||
else if (itemName.includes('chestplate')) {
|
||||
else if (itemName.includes('chestplate') || itemName.includes('elytra')) {
|
||||
await bot.equip(item, 'torso');
|
||||
}
|
||||
else {
|
||||
await bot.equip(item, 'hand');
|
||||
}
|
||||
log(bot, `Equipped ${itemName}.`);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue