|
|
@ -9,7 +9,7 @@ const autoeat = require("mineflayer-auto-eat") |
|
|
|
|
|
|
|
const options = { |
|
|
|
host: "127.0.0.1", // Server IP
|
|
|
|
port: 54825, // Server port
|
|
|
|
port: 50128, // Server port
|
|
|
|
username: 'V5-Bot', // Bot name
|
|
|
|
} |
|
|
|
|
|
|
@ -75,6 +75,7 @@ function lightUp() { |
|
|
|
z |
|
|
|
}) |
|
|
|
if (potentialLightableBlock.transparent === false && isAir.light <= 7){ |
|
|
|
bot.equip(bot.inventory.findInventoryItem('torch')) |
|
|
|
bot.placeBlock('torch',isAir.position) |
|
|
|
} |
|
|
|
} |
|
|
@ -92,14 +93,14 @@ bot.once('spawn', () => { |
|
|
|
|
|
|
|
setInterval(() => { |
|
|
|
if (bot.health >=6){ |
|
|
|
const mobFilter = e => e.type === 'mob' && e.mobType === 'Slime' || 'Zombie' |
|
|
|
const mobFilter = e => (e.type === 'mob' && (e.mobType === 'Slime' || e.mobType === 'Zombie' || e.mobType === 'Spider')) |
|
|
|
const mob = bot.nearestEntity(mobFilter) |
|
|
|
if (!mob) return |
|
|
|
const pos = mob.position.offset(0,mob.height,0) |
|
|
|
const dist = pos.distanceTo(bot.entity.position) |
|
|
|
bot.lookAt(pos, true) |
|
|
|
if (dist >= 20) return |
|
|
|
if (dist <= 10 && bot.heldItem.type !== 'diamond_sword' && bot.inventory.findInventoryItem('diamond_sword') !== null) { |
|
|
|
if (dist <= 10 && bot.inventory.findInventoryItem('diamond_sword')) { |
|
|
|
bot.equip(bot.inventory.findInventoryItem('diamond_sword')) |
|
|
|
} |
|
|
|
//console.log(dist)
|
|
|
@ -109,7 +110,7 @@ bot.once('spawn', () => { |
|
|
|
// console.log('is not Fighting')
|
|
|
|
//}
|
|
|
|
} |
|
|
|
}, 1000) |
|
|
|
}, 800) |
|
|
|
}) |
|
|
|
|
|
|
|
bot.on("autoeat_started", () => { |
|
|
|