Browse Source

correction issue #1

master
fhalley 2 years ago
parent
commit
becb65094f
  1. 9
      README.md
  2. 19
      bot5.js

9
README.md

@ -0,0 +1,9 @@
Ce bot est un développement réalisé par la SCIC Mycéliandre.
Le but est de disposer d'un outil suplémentaire dans le cadre de l'aide aux devoirs sur minecraft.
| Version | Date | Notes |
|---|---|---|
| 0.1 | 15/06/2022 | Premier push |
| 0.11 | 16/06/2022 | Correction issue #1 |
| | | |

19
bot5.js

@ -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,23 +110,23 @@ bot.once('spawn', () => {
// console.log('is not Fighting')
//}
}
}, 1000)
}, 800)
})
bot.on("autoeat_started", () => {
console.log("Auto Eat started!")
})
})
bot.on("autoeat_stopped", () => {
bot.on("autoeat_stopped", () => {
console.log("Auto Eat stopped!")
bot.sw
})
})
bot.on("health", () => {
bot.on("health", () => {
if (bot.food === 20) bot.autoEat.disable()
// Disable the plugin if the bot is at 20 food points
else bot.autoEat.enable() // Else enable the plugin again
})
})
bot.on('chat', (username, message) => {

Loading…
Cancel
Save