mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-04-21 21:52:07 +02:00
fixed furnace commands
This commit is contained in:
parent
5482a5dc7e
commit
7b77c395d0
2 changed files with 16 additions and 5 deletions
|
@ -254,6 +254,14 @@ export const actionsList = [
|
|||
return response;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '!clearFurnace',
|
||||
description: 'Tak all items out of the nearest furnace.',
|
||||
params: { },
|
||||
perform: wrapExecution(async (agent) => {
|
||||
await skills.clearNearestFurnace(agent.bot);
|
||||
})
|
||||
},
|
||||
{
|
||||
name: '!placeHere',
|
||||
description: 'Place a given block in the current location. Do NOT use to build structures, only use for single blocks/torches.',
|
||||
|
|
|
@ -181,7 +181,7 @@ export async function smeltItem(bot, itemName, num=1) {
|
|||
let total = 0;
|
||||
let collected_last = true;
|
||||
let smelted_item = null;
|
||||
bot.mods.pause('unstuck');
|
||||
bot.modes.pause('unstuck');
|
||||
await new Promise(resolve => setTimeout(resolve, 200));
|
||||
while (total < num) {
|
||||
await new Promise(resolve => setTimeout(resolve, 10000));
|
||||
|
@ -203,7 +203,7 @@ export async function smeltItem(bot, itemName, num=1) {
|
|||
}
|
||||
}
|
||||
await bot.closeWindow(furnace);
|
||||
bot.mods.unpause('unstuck');
|
||||
bot.modes.unpause('unstuck');
|
||||
|
||||
if (placedFurnace) {
|
||||
await collectBlock(bot, 'furnace', 1);
|
||||
|
@ -228,11 +228,14 @@ export async function clearNearestFurnace(bot) {
|
|||
* @example
|
||||
* await skills.clearNearestFurnace(bot);
|
||||
**/
|
||||
let furnaceBlock = world.getNearestBlock(bot, 'furnace', 6);
|
||||
if (!furnaceBlock){
|
||||
log(bot, `There is no furnace nearby.`)
|
||||
let furnaceBlock = world.getNearestBlock(bot, 'furnace', 32);
|
||||
if (!furnaceBlock) {
|
||||
log(bot, `No furnace nearby to clear.`);
|
||||
return false;
|
||||
}
|
||||
if (bot.entity.position.distanceTo(furnaceBlock.position) > 4) {
|
||||
await goToNearestBlock(bot, 'furnace', 4, 32);
|
||||
}
|
||||
|
||||
console.log('clearing furnace...');
|
||||
const furnace = await bot.openFurnace(furnaceBlock);
|
||||
|
|
Loading…
Add table
Reference in a new issue