fixed furnace commands

This commit is contained in:
MaxRobinsonTheGreat 2024-10-10 20:04:02 -05:00
parent 5482a5dc7e
commit 7b77c395d0
2 changed files with 16 additions and 5 deletions

View file

@ -254,6 +254,14 @@ export const actionsList = [
return response; 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', name: '!placeHere',
description: 'Place a given block in the current location. Do NOT use to build structures, only use for single blocks/torches.', description: 'Place a given block in the current location. Do NOT use to build structures, only use for single blocks/torches.',

View file

@ -181,7 +181,7 @@ export async function smeltItem(bot, itemName, num=1) {
let total = 0; let total = 0;
let collected_last = true; let collected_last = true;
let smelted_item = null; let smelted_item = null;
bot.mods.pause('unstuck'); bot.modes.pause('unstuck');
await new Promise(resolve => setTimeout(resolve, 200)); await new Promise(resolve => setTimeout(resolve, 200));
while (total < num) { while (total < num) {
await new Promise(resolve => setTimeout(resolve, 10000)); await new Promise(resolve => setTimeout(resolve, 10000));
@ -203,7 +203,7 @@ export async function smeltItem(bot, itemName, num=1) {
} }
} }
await bot.closeWindow(furnace); await bot.closeWindow(furnace);
bot.mods.unpause('unstuck'); bot.modes.unpause('unstuck');
if (placedFurnace) { if (placedFurnace) {
await collectBlock(bot, 'furnace', 1); await collectBlock(bot, 'furnace', 1);
@ -228,11 +228,14 @@ export async function clearNearestFurnace(bot) {
* @example * @example
* await skills.clearNearestFurnace(bot); * await skills.clearNearestFurnace(bot);
**/ **/
let furnaceBlock = world.getNearestBlock(bot, 'furnace', 6); let furnaceBlock = world.getNearestBlock(bot, 'furnace', 32);
if (!furnaceBlock){ if (!furnaceBlock) {
log(bot, `There is no furnace nearby.`) log(bot, `No furnace nearby to clear.`);
return false; return false;
} }
if (bot.entity.position.distanceTo(furnaceBlock.position) > 4) {
await goToNearestBlock(bot, 'furnace', 4, 32);
}
console.log('clearing furnace...'); console.log('clearing furnace...');
const furnace = await bot.openFurnace(furnaceBlock); const furnace = await bot.openFurnace(furnaceBlock);