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