Browse Source

correction issue #1

master
fhalley 2 years ago
parent
commit
becb65094f
  1. 9
      README.md
  2. 9
      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 |
| | | |

9
bot5.js

@ -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", () => {

Loading…
Cancel
Save