Compare commits

...

4 Commits

Author SHA1 Message Date
jay afd2e002df feat(mover): add new pathfinder Movements 3 years ago
jay 3c5ec6b360 fix(mover): ✏️ fix `!go up` moving left instead 3 years ago
jay b71728e503 feat(mover): add Mule to ridable mobs 3 years ago
jay d001280383 fix: 🥅 fix a plugin loading error 3 years ago
  1. 4
      lib/index.js
  2. 17
      lib/plugins/mover.js

@ -47,7 +47,9 @@ function unloadplugin(pluginname, pluginpath) {
const plugin = require.resolve(pluginpath)
try {
if (plugin && require.cache[plugin]) {
require.cache[plugin].exports.unload()
// `unload()` isn't exported sometimes,
// when plugin isn't properly loaded
require.cache[plugin].exports?.unload?.()
delete plugins[pluginname]
delete require.cache[plugin]
}

@ -23,6 +23,19 @@ function initMoves(bot = bot, mcData = bot.mcData) {
movements.push(normalMove)
movements.defaultMove = movements[0]
const aggresiveMove = new Movements(bot, mcData)
//Object.create or assign?
Object.assign(aggresiveMove, normalMove)
aggresiveMove.canDig = true
movements.push(aggresiveMove)
const safeMove = new Movements(bot, mcData)
Object.assign(safeMove, normalMove)
safeMove.allowParkour = false
safeMove.canDig = false
movements.push(safeMove)
// console.info("go init: moves:", movements)
bot.pathfinder.setMovements(normalMove)
}
@ -143,7 +156,7 @@ function away(entity = bot.nearestEntity(), invertInvert = true, dynamic = true,
function ride(entity) {
entity = entity?.entity || entity
const ridableMobs = ["Horse", "Donkey", "Pig", "Strider"]
const ridableMobs = ["Horse", "Donkey", "Pig", "Strider", "Mule"]
const vehicle = entity && typeof entity !== "string" ? entity : bot.nearestEntity(e => {
if (typeof entity === "string") return e.name === entity
const maybeRidableMob = e.mobType?.split(" ")
@ -314,7 +327,7 @@ function command(message_parts, player) {
case "up":
case "u":
case "j":
moveOrRide(1, 1, "left", message_parts2)
moveOrRide(1, 1, "jump", message_parts2)
break
case "back":
case "forward":

Loading…
Cancel
Save