Compare commits
30 Commits
f50e388c39
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
feb0b0927a | ||
|
8276e68489 | ||
|
2b7163bef3 | ||
|
a0b4641f37 | ||
|
186d6ac3d2 | ||
|
984c9490c3 | ||
|
3379f75ab9 | ||
|
69b1ab0b0b | ||
|
3c9d62441f | ||
|
665102e19c | ||
|
db459f52e6 | ||
|
360eeff02f | ||
|
25faac2f4c | ||
|
ccf0c598e8 | ||
|
050e2b3bd9 | ||
|
e879d1f4ad | ||
|
df193da779 | ||
|
269d258763 | ||
|
cbb105fe49 | ||
|
356f83e39b | ||
|
5b3804893b | ||
|
9f6fea2423 | ||
|
3686bab167 | ||
|
e0c477a46f | ||
|
6046123074 | ||
|
ae1f7cf269 | ||
|
afd2e002df | ||
|
3c5ec6b360 | ||
|
b71728e503 | ||
|
d001280383 |
44
lib/index.js
44
lib/index.js
@@ -1,8 +1,8 @@
|
||||
const env = require("dotenv-packed").parseEnv().parsed
|
||||
const fs = require('fs');
|
||||
let cfg = {
|
||||
admin: "Applezaus",
|
||||
mods: ["Applezaus", "tanner6", "Angram42", "[WEB] Angram42", "[WEB] Applezaus"],
|
||||
const cfg = {
|
||||
admin: process.env.MINECRAFT_PLAYER_ADMIN || env.MINECRAFT_PLAYER_ADMIN || console.warn("main: bot admin user not provided"),
|
||||
mods: process.env.MINECRAFT_PLAYER_MODS || env.MINECRAFT_PLAYER_MODS || [], // json array,
|
||||
stateMachines: {}
|
||||
}
|
||||
|
||||
@@ -29,25 +29,28 @@ cfg.botOptions = options
|
||||
|
||||
let plugins = {}
|
||||
|
||||
function loadplugin(pluginname, pluginpath) {
|
||||
function loadplugin(pluginname, pluginpath = './plugins/' + pluginname) {
|
||||
try {
|
||||
plugins[pluginname] = require(pluginpath)
|
||||
plugins[pluginname].load(cfg)
|
||||
} catch (error) {
|
||||
if (error.code == 'MODULE_NOT_FOUND') {
|
||||
console.warn('plugin not used:', pluginpath)
|
||||
} else if (plugins[pluginname] && !plugins[pluginname].load) {
|
||||
unloadplugin(pluginname, pluginpath)
|
||||
} else {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function unloadplugin(pluginname, pluginpath) {
|
||||
pluginpath = pluginpath ? pluginpath : './plugins/' + pluginname
|
||||
function unloadplugin(pluginname, pluginpath = './plugins/' + pluginname) {
|
||||
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]
|
||||
}
|
||||
@@ -56,20 +59,28 @@ function unloadplugin(pluginname, pluginpath) {
|
||||
}
|
||||
}
|
||||
|
||||
reloadplugin = (event, filename, pluginpath) => {
|
||||
function reloadplugin(event, filename, pluginpath = './plugins/') {
|
||||
if (!/\.js$/.test(filename)) { return }
|
||||
filename = filename.replace("\\", "/") // windows
|
||||
if (!cfg.fsTimeout) {
|
||||
console.info(event, filename)
|
||||
pluginpath = (pluginpath ? pluginpath : './plugins/') + filename
|
||||
const fullpluginpath = pluginpath + filename
|
||||
const pluginname = (filename.split(".js")[0]).replace(/\/.+/, "")
|
||||
pluginpath = pluginpath + pluginname
|
||||
const hassubplugin = fullpluginpath.replace(/\.js$/, "") !== pluginpath
|
||||
const check = Object.keys(cfg.plugins)
|
||||
console.info(`reload file: ./lib/${pluginpath}`)
|
||||
const plugin = require.resolve(pluginpath)
|
||||
console.info(`reload file: ./lib/${fullpluginpath}`)
|
||||
const plugin = require.resolve(fullpluginpath)
|
||||
if (plugin && require.cache[plugin]) {
|
||||
// console.debug(Object.keys(cfg.plugins))
|
||||
unloadplugin(filename.split(".js")[0], pluginpath)
|
||||
unloadplugin(pluginname)
|
||||
console.assert(Object.keys(cfg.plugins).length == check.length - 1, "plugin not removed, potential memory leak")
|
||||
if (hassubplugin) {
|
||||
console.info("reload: also unloading sub")
|
||||
unloadplugin(pluginname, fullpluginpath)
|
||||
}
|
||||
loadplugin(filename.split(".js")[0], pluginpath)
|
||||
}
|
||||
loadplugin(pluginname)
|
||||
if (Object.keys(cfg.plugins).length != check.length) {
|
||||
// If left < right :
|
||||
// - new plugin that's not registered in cfg.plugins, so added
|
||||
@@ -83,7 +94,7 @@ reloadplugin = (event, filename, pluginpath) => {
|
||||
// console.log('file.js %s event', event)
|
||||
}
|
||||
|
||||
fs.watch('./lib/plugins', reloadplugin)
|
||||
fs.watch('./lib/plugins', { recursive: true }, reloadplugin)
|
||||
|
||||
cfg.bot = bot
|
||||
// TODO better name, or switch to array
|
||||
@@ -109,7 +120,10 @@ bot.once("spawn", () => {
|
||||
}
|
||||
|
||||
cfg.plugins = plugins
|
||||
cfg.botAddressRegex = new RegExp(`^${bot.username} (${cfg.botAddressPrefix}.+)`)
|
||||
// cfg.botAddressPrefix = ${bot.username.substr(-2,2)}
|
||||
cfg.botAddressRegex = new RegExp(`^${bot.username}:? (/|${cfg.botAddressPrefix}.+)`)
|
||||
// FIXME leaks every load, so adding here instead of command.js to load only once
|
||||
bot.addChatPattern("web", /\[WEB\] (\[.+\])?\s*([\w.]+): (.+)/, { parse: true })
|
||||
|
||||
for (const plugin of Object.values(plugins)) {
|
||||
try {
|
||||
|
@@ -27,12 +27,12 @@ function checkItemExists(name) {
|
||||
}
|
||||
|
||||
const events = {
|
||||
whisper: function command_whisper(username, message) {
|
||||
if ([bot.username, "me"].includes(username)) return
|
||||
whisper: function command_whisper(username, _botusername, message, ...history) {
|
||||
if ([bot.username, "me"].includes(username)) return // whisper back from server (afk msges, etc)
|
||||
if (/^gossip/.test(message)) return
|
||||
if (username === cfg.admin) {
|
||||
console.info("whispered command", _botusername, message)
|
||||
message = message.replace("\\", "@")
|
||||
console.info("whispered command", message)
|
||||
if (message.startsWith(cfg.botAddressPrefix)) {
|
||||
command(username, message)
|
||||
} else {
|
||||
@@ -41,7 +41,7 @@ const events = {
|
||||
}
|
||||
} else {
|
||||
bot.whisper(cfg.admin, `gossip ${username}: ${message}`)
|
||||
console.info(username, "whispered", message)
|
||||
console.info(username, "whispered", _botusername, message)
|
||||
}
|
||||
}
|
||||
, chat: command
|
||||
@@ -56,6 +56,30 @@ const events = {
|
||||
}, 15 * 60 * 1000, bot, cfg);
|
||||
}
|
||||
}
|
||||
// , message: systemMessage
|
||||
, messagestr: function systemMessageStr(...args) { console.log("cmd msgstr:", ...args) }
|
||||
, "chat:web": commandWeb
|
||||
}
|
||||
|
||||
function systemMessage(...args) {
|
||||
if (args[0]?.text) return
|
||||
const metadata = (args[0]?.extra || args[0]?.with)?.map(v => v.text)
|
||||
console.log(
|
||||
"cmd msg:",
|
||||
args[0]?.text || args[0]?.translate,
|
||||
args[0]?.extra?.length || args[0]?.with?.length || Object.keys(args[0]?.json).length - 1,
|
||||
metadata.length > 0 && metadata || args[0],
|
||||
args.slice(1)
|
||||
)
|
||||
}
|
||||
|
||||
function commandWeb([[mode, username, message]]) {
|
||||
// console.log("web msg:", mode, username, message)
|
||||
message && command(username, message)
|
||||
}
|
||||
|
||||
function _clientSystemMessage(...args) {
|
||||
console.log("cmd chat:", args[0]?.message, args[0]?.extra?.length, args[0]?.extra, args[0], args.slice(1))
|
||||
}
|
||||
|
||||
const events_registered = []
|
||||
@@ -521,6 +545,8 @@ const load = (config) => {
|
||||
bot.on(key, fn)
|
||||
)
|
||||
}
|
||||
|
||||
// bot._client.on("chat", _clientSystemMessage)
|
||||
}
|
||||
|
||||
const unload = () => {
|
||||
@@ -530,6 +556,8 @@ const unload = () => {
|
||||
events_registered.shift()
|
||||
}
|
||||
console.log("events_registered:", bot._eventsCount)
|
||||
|
||||
// bot._client.off("chat", _clientSystemMessage)
|
||||
}
|
||||
|
||||
module.exports = { load, unload, events_registered, command }
|
@@ -1,39 +1,104 @@
|
||||
let cfg
|
||||
let bot
|
||||
let mcData
|
||||
let quiet
|
||||
// import v from 'vec3'
|
||||
const v = require('vec3')
|
||||
|
||||
function block(pos) {
|
||||
const block = pos ? bot.blockAt(v(pos)) : bot.blockAtCursor()
|
||||
console.log(block, block && block.getProperties())
|
||||
let cfg = {
|
||||
info: {
|
||||
quiet: quiet,
|
||||
recentCommand: null,
|
||||
},
|
||||
// to satisfy typescript
|
||||
quiet: null,
|
||||
bot: bot
|
||||
}
|
||||
|
||||
var RelativePosEnum
|
||||
(function (RelativePosEnum) {
|
||||
RelativePosEnum[RelativePosEnum["feet"] = 0] = "feet"
|
||||
RelativePosEnum[RelativePosEnum["standing"] = 1] = "standing"
|
||||
RelativePosEnum[RelativePosEnum["head"] = 2] = "head"
|
||||
RelativePosEnum[RelativePosEnum["looking"] = 3] = "looking"
|
||||
RelativePosEnum[RelativePosEnum["infront"] = 4] = "infront"
|
||||
RelativePosEnum[RelativePosEnum["behind"] = 5] = "behind"
|
||||
})(RelativePosEnum || (RelativePosEnum = {}))
|
||||
|
||||
function relPosToBlock(entity, relPos) {
|
||||
let pos
|
||||
if (!(relPos in RelativePosEnum)) return console.warn("info: not a relative position:", relPos)
|
||||
relPos = typeof relPos === "number" ? RelativePosEnum[relPos] : relPos
|
||||
switch (relPos) {
|
||||
case "feet":
|
||||
pos = entity.position;
|
||||
break
|
||||
case "standing":
|
||||
pos = entity.position.offset(0, -1, 0)
|
||||
break
|
||||
// todo use CARDINAL directions api from pathfinder
|
||||
// case "behind":
|
||||
// entity.yaw
|
||||
// pos = entity.position
|
||||
// break
|
||||
// case "front":
|
||||
// case "infront":
|
||||
// pos = entity.position
|
||||
// break
|
||||
case "head":
|
||||
pos = entity.position.offset(0, 1.85, 0)
|
||||
break
|
||||
case "looking":
|
||||
if (entity === bot.entity) {
|
||||
return bot.blockAtCursor()
|
||||
// return bot.blockInSight(128, 128)
|
||||
}
|
||||
default:
|
||||
quiet || bot.chat(`info: pos '${relPos}' not implemented`)
|
||||
break
|
||||
}
|
||||
if (pos) {
|
||||
// nearest block
|
||||
return bot.blockAt(pos)
|
||||
}
|
||||
}
|
||||
|
||||
function isVec3(vec) {
|
||||
return vec?.length === 3 || vec.x && vec.y && vec.z
|
||||
}
|
||||
|
||||
function block(entity = bot.entity, pos = entity?.position?.offset(0, -1, 0)) {
|
||||
console.assert(pos || entity)
|
||||
const block = isVec3(pos) ? bot.blockAt(v(pos))
|
||||
: typeof pos === "string" ? relPosToBlock(entity, RelativePosEnum[pos]) : pos
|
||||
console.log(block, block?.getProperties && block.getProperties())
|
||||
if (!block) {
|
||||
cfg.quiet || bot.chat("empty block")
|
||||
quiet || bot.chat("empty block")
|
||||
return block
|
||||
}
|
||||
bot.lookAt(block?.position)
|
||||
let info = [block.type, block.name]
|
||||
if (block.metadata) info.push(Object.entries(block.getProperties()))
|
||||
cfg.quiet || bot.chat(info.join(": "))
|
||||
quiet || bot.chat(info.join(": "))
|
||||
}
|
||||
|
||||
function item(
|
||||
slot,
|
||||
entity = bot.entity
|
||||
entity = bot.entity,
|
||||
slot = entity.heldItem
|
||||
) {
|
||||
const item = slot ?
|
||||
bot.inventory.slots[parseInt(slot) + bot.QUICK_BAR_START] :
|
||||
entity.heldItem
|
||||
console.log(item)
|
||||
const item = typeof slot === "number" ?
|
||||
bot.inventory.slots[slot + bot.QUICK_BAR_START] :
|
||||
slot
|
||||
console.log("info item:", item)
|
||||
if (!item) {
|
||||
cfg.quiet || bot.chat("no item")
|
||||
quiet || bot.chat("no item")
|
||||
return item
|
||||
}
|
||||
let info = [item.type, item.name]
|
||||
let info = [item.type, item.name, item.count]
|
||||
if (item.metadata) info.push("meta: " + item.metadata.length)
|
||||
if (item.nbt) {
|
||||
info.push(compound_value(item.nbt))
|
||||
}
|
||||
cfg.quiet || bot.chat(info.join("; "))
|
||||
quiet || bot.chat(info.join("; "))
|
||||
function compound_value(obj) {
|
||||
if (typeof obj.value == "object") {
|
||||
return compound_value(obj.value)
|
||||
@@ -51,27 +116,110 @@ function item(
|
||||
return item
|
||||
}
|
||||
|
||||
function entity(name) {
|
||||
const entity = typeof name === "string" ? bot.nearestEntity((entity) => {
|
||||
const ename = entity.name || entity.username
|
||||
return name && ename ? ename == name : true
|
||||
}) : entity
|
||||
console.log(entity)
|
||||
var VillagerProfession
|
||||
(function (VillagerProfession) {
|
||||
VillagerProfession[VillagerProfession["Unemployed"] = 0] = "Unemployed"
|
||||
VillagerProfession[VillagerProfession["Armourer"] = 1] = "Armourer"
|
||||
VillagerProfession[VillagerProfession["Butcher"] = 2] = "Butcher"
|
||||
VillagerProfession[VillagerProfession["Cartographer"] = 3] = "Cartographer"
|
||||
VillagerProfession[VillagerProfession["Cleric"] = 4] = "Cleric"
|
||||
VillagerProfession[VillagerProfession["Farmer"] = 5] = "Farmer"
|
||||
VillagerProfession[VillagerProfession["Fisherman"] = 6] = "Fisherman"
|
||||
VillagerProfession[VillagerProfession["Fletcher"] = 7] = "Fletcher"
|
||||
VillagerProfession[VillagerProfession["Leatherworker"] = 8] = "Leatherworker"
|
||||
VillagerProfession[VillagerProfession["Librarian"] = 9] = "Librarian"
|
||||
VillagerProfession[VillagerProfession["Mason"] = 10] = "Mason"
|
||||
VillagerProfession[VillagerProfession["Nitwit"] = 11] = "Nitwit"
|
||||
VillagerProfession[VillagerProfession["Shepherd"] = 12] = "Shepherd"
|
||||
VillagerProfession[VillagerProfession["Toolsmith"] = 13] = "Toolsmith"
|
||||
VillagerProfession[VillagerProfession["Weaponsmith"] = 14] = "Weaponsmith"
|
||||
})(VillagerProfession || (VillagerProfession = {}))
|
||||
|
||||
function entity(name = bot.nearestEntity()) {
|
||||
const entity = typeof name === "string" ? (name = name.toLowerCase()) && bot.nearestEntity((entity) => {
|
||||
const enames = [entity.username?.toLowerCase(), entity.name, entity.displayName?.toLowerCase()]
|
||||
return enames.includes(name)
|
||||
}) : name
|
||||
console.log("info entity:", entity)
|
||||
if (!entity) {
|
||||
cfg.quiet || bot.chat("no entity")
|
||||
quiet || bot.chat("no entity")
|
||||
return entity
|
||||
}
|
||||
let info = [entity.type, entity.username || entity.name]
|
||||
entity?.position && bot.lookAt(entity.position)
|
||||
let info = [(entity.entityType && entity.entityType + ":" || "") + (entity.type === "object" ? entity.kind : entity.type)]
|
||||
info.push(entity.username || entity.name)
|
||||
// TODO various info depending on the type of entity; player, villager, etc
|
||||
// TODO refactor and combine with compound_value()
|
||||
switch (entity.type) {
|
||||
case "object":
|
||||
switch (entity.kind) {
|
||||
case "Drops":
|
||||
const item = entity.metadata[7];
|
||||
entity.metadata;
|
||||
if (item.present) {
|
||||
info.push("item: " + item.itemId + ": "
|
||||
+ mcData.items[item.itemId].name
|
||||
+ `x${item.itemCount}`);
|
||||
}
|
||||
else {
|
||||
console.warn("info entity: metadata expected item, got:", entity.metadata[7]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
break;
|
||||
case "mob":
|
||||
switch (name) {
|
||||
case 'villager':
|
||||
const { villagerProfession, ...otherProps } = entity.metadata[17]
|
||||
info.push(VillagerProfession[villagerProfession])
|
||||
info.push(Object.entries(otherProps).toString())
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
entity.metadata[8] && info.push("health:" + entity.metadata[8])
|
||||
entity.metadata[15] && info.push("baby")
|
||||
if (entity.heldItem) {
|
||||
info.push("holding")
|
||||
item(entity)
|
||||
}
|
||||
case "global":
|
||||
case "orb":
|
||||
case "player":
|
||||
break;
|
||||
case "other":
|
||||
info.push("kind:" + entity.kind)
|
||||
default:
|
||||
}
|
||||
if (entity.metadata) info.push("len: " + entity.metadata.length)
|
||||
cfg.quiet || bot.chat(info.join("; "))
|
||||
quiet || bot.chat(info.join("; "))
|
||||
return entity
|
||||
}
|
||||
|
||||
function blockOrItemFromId(num, quiet = cfg.info.quiet) {
|
||||
const block = mcData?.blocks[num]
|
||||
const item = mcData?.items[num]
|
||||
// const entity = mcData?.entities[num]
|
||||
if (block || item) {
|
||||
quiet || bot.chat(
|
||||
(block && `block: ${block.name}, ` || "")
|
||||
+ (item && `item: ${item.name}, ` || "")
|
||||
// + (entity && `entity: ${entity.name}, ` || "")
|
||||
)
|
||||
} else {
|
||||
quiet || bot.chat("info: nonexistent block or item")
|
||||
}
|
||||
return { block, item }
|
||||
}
|
||||
|
||||
function command(message_parts, player) {
|
||||
if (message_parts.length > 0) {
|
||||
cfg.info.recentCommand = message_parts
|
||||
}
|
||||
if (player === null)
|
||||
player = void 0
|
||||
switch (message_parts.length) {
|
||||
case 0:
|
||||
if (cfg.info.recentCommand) {
|
||||
@@ -79,11 +227,15 @@ function command(message_parts, player) {
|
||||
} else {
|
||||
// TODO dispatch on instance of entity, block, etc..
|
||||
// TODO have the logic inside the function or with a utility function
|
||||
block(player.position || player?.entity.position || null)
|
||||
block()
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
switch (message_parts[0]) {
|
||||
case "quiet":
|
||||
cfg.info.quiet = quiet = !quiet;
|
||||
quiet || bot.chat(`info: ${quiet ? "" : "not "}being quiet`);
|
||||
break;
|
||||
case "i":
|
||||
case "item":
|
||||
item()
|
||||
@@ -92,10 +244,20 @@ function command(message_parts, player) {
|
||||
case "entity":
|
||||
entity()
|
||||
break
|
||||
case "me":
|
||||
block(player)
|
||||
break
|
||||
case "b":
|
||||
case "block":
|
||||
default:
|
||||
block()
|
||||
break
|
||||
default:
|
||||
const num = parseInt(message_parts[0])
|
||||
if (isFinite(num)) {
|
||||
blockOrItemFromId(num)
|
||||
} else {
|
||||
quiet || bot.chat("info usage: `!info [me|i|e|b|<num>|quiet]`")
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -105,7 +267,43 @@ function command(message_parts, player) {
|
||||
switch (message_parts[0]) {
|
||||
case "i":
|
||||
case "item":
|
||||
item(message_parts[1])
|
||||
switch (message_parts[1]) {
|
||||
case "me":
|
||||
item(player)
|
||||
break
|
||||
default:
|
||||
const slot = parseInt(message_parts[1])
|
||||
slot && item(undefined, slot)
|
||||
break
|
||||
}
|
||||
break
|
||||
case "b":
|
||||
case "block":
|
||||
switch (message_parts[1]) {
|
||||
case "me":
|
||||
block(player)
|
||||
break
|
||||
default:
|
||||
const aPlayer = bot.players[message_parts[1]]
|
||||
if (message_parts[1] in RelativePosEnum) {
|
||||
block(undefined, message_parts[1])
|
||||
} else if (aPlayer) {
|
||||
if (aPlayer.entity) {
|
||||
block(aPlayer.entity)
|
||||
} else {
|
||||
quiet || bot.chat(`info: player ${aPlayer.username} too far!`)
|
||||
}
|
||||
} else {
|
||||
// or entity(message_parts[1]).position
|
||||
console.log(bot.players[message_parts[1]])
|
||||
quiet || bot.chat("info: not yet implemented")
|
||||
}
|
||||
}
|
||||
break
|
||||
case "me":
|
||||
if (message_parts[1] in RelativePosEnum) {
|
||||
block(player, message_parts[1])
|
||||
}
|
||||
break
|
||||
case "e":
|
||||
case "entity":
|
||||
@@ -120,7 +318,7 @@ function command(message_parts, player) {
|
||||
case "b":
|
||||
case "block":
|
||||
default:
|
||||
block(message_parts.slice(1))
|
||||
block(undefined, message_parts.slice(1))
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -133,12 +331,9 @@ function command(message_parts, player) {
|
||||
}
|
||||
|
||||
const load = (config) => {
|
||||
config.info = cfg.info
|
||||
cfg = config
|
||||
bot = cfg.bot
|
||||
cfg.info = {
|
||||
quiet: cfg.quiet,
|
||||
recentCommand: null,
|
||||
}
|
||||
mcData = bot.mcData || (bot.mcData = require('minecraft-data')(bot.version))
|
||||
}
|
||||
|
||||
|
@@ -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":
|
||||
|
14
package.json
14
package.json
@@ -30,16 +30,16 @@
|
||||
},
|
||||
"homepage": "https://github.com/PrismarineJS/prismarine-template#readme",
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.14.35",
|
||||
"@types/node": "^14.14.41",
|
||||
"jest": "^26.6.3",
|
||||
"require-self": "^0.2.3",
|
||||
"typescript": "^4.2.3"
|
||||
"typescript": "^4.2.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"dotenv-packed": "^1.2.1",
|
||||
"minecraft-data": "^2.80.0",
|
||||
"mineflayer": "^3.4.0",
|
||||
"mineflayer-armor-manager": "^1.4.0",
|
||||
"dotenv-packed": "^1.2.2",
|
||||
"minecraft-data": "^2.84.0",
|
||||
"mineflayer": "^3.6.0",
|
||||
"mineflayer-armor-manager": "^1.4.1",
|
||||
"mineflayer-pathfinder": "^1.6.1",
|
||||
"mineflayer-pvp": "^1.0.2",
|
||||
"prismarine-block": "^1.8.0",
|
||||
@@ -49,7 +49,7 @@
|
||||
"prismarine-nbt": "^1.5.0",
|
||||
"prismarine-recipe": "^1.1.0",
|
||||
"vec3": "^0.1.7",
|
||||
"xstate": "^4.17.0"
|
||||
"xstate": "^4.18.0"
|
||||
},
|
||||
"files": [
|
||||
"lib/**/*"
|
||||
|
Reference in New Issue
Block a user