65 lines
1.3 KiB
JavaScript
65 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
const conf = require('../conf');
|
|
const {sleep} = require('../utils');
|
|
|
|
class Craft{
|
|
constructor(args){
|
|
this.bot = args.bot;
|
|
this.interval = args.interval;
|
|
this.target = args.target;
|
|
this.intervalStop;
|
|
this.isAction = true;
|
|
}
|
|
|
|
async init(){
|
|
this.bot.on('onReady', async ()=>{
|
|
this.bot.bot.setControlState('jump', true);
|
|
setTimeout(()=> this.bot.bot.setControlState('jump', false), 2000);
|
|
await sleep(2000);
|
|
|
|
let chest = this.bot.findChestBySign('FILLED BOXES');
|
|
await this.bot.goTo({
|
|
where: chest,
|
|
range: 3,
|
|
});
|
|
await this.bot.getFullShulkersFromChest(chest, {id:3});
|
|
|
|
// goto 'FILLED BOXES' box
|
|
// get 4 boxes of 'prismarine_shard'
|
|
// get 5 boxes of 'prismarine_crystals'
|
|
// place boxes
|
|
|
|
});
|
|
}
|
|
|
|
unload(){
|
|
if(this.intervalStop){
|
|
clearInterval(this.intervalStop);
|
|
this.intervalStop = undefined;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
async goToSpot(){
|
|
await this.bot.goTo({
|
|
where: this.bot.findBlockBySign('guardian\nattack spot'),
|
|
range: 0,
|
|
});
|
|
}
|
|
|
|
async swing(){
|
|
this.intervalStop = setInterval(()=>{
|
|
try{
|
|
this.bot.bot.attack(
|
|
this.bot.bot.nearestEntity(
|
|
entity => entity.name.toLowerCase() === 'guardian'
|
|
)
|
|
);
|
|
}catch(error){}
|
|
}, 4000);
|
|
}
|
|
}
|
|
|
|
module.exports = Craft;
|