mineflayer-utility-bot
v0.1.2
Published
A utility package for Mineflayer bots, including automatic eating and totem handling.
Maintainers
Readme
Mineflayer Utility Bot
A comprehensive Mineflayer utility package that combines automatic eating, totem management, and death tracking into a single module.
GitHub Repository: https://github.com/FourTerms2/mineflayer-utility-bot
💬 Discord Community
Join our Discord server for support, updates, and community discussions. For faster support, please make a ticket: https://discord.gg/RMC3PcKrpt
Features
Auto Eat
- Automatically eats food when hunger drops below 20
- Configurable food list with sensible defaults
- Checks inventory every 2 seconds
Auto Totem
- Automatically equips Totem of Undying when health drops below 10 HP
- Continuous health monitoring (100ms intervals)
- Searches entire inventory for totems
Death Tracking
- Logs all bot deaths with timestamps
- Records death location (X, Y, Z coordinates)
- Identifies killer (player, mob, or environmental)
- Logs weapon used by player killers
- Saves death log to
death.txtfile
Installation
npm install mineflayer-utility-botUsage
Basic Setup
const mineflayer = require('mineflayer');
const { Food, AutoTotem, BotDeath } = require('mineflayer-utility-bot');
const bot = mineflayer.createBot({
host: 'localhost',
username: 'bot'
});
// Initialize all utilities
const food = new Food(bot);
const autoTotem = new AutoTotem(bot);
autoTotem.start();
const deathTracker = new BotDeath(bot);Using Individual Modules
You can use only the modules you need:
// Only auto-eating
const { Food } = require('mineflayer-utility-bot');
const food = new Food(bot);
// Only totem management
const { AutoTotem } = require('mineflayer-utility-bot');
const autoTotem = new AutoTotem(bot);
autoTotem.start();
// Only death tracking
const { BotDeath } = require('mineflayer-utility-bot');
const deathTracker = new BotDeath(bot);API Reference
Food Class
Constructor: new Food(bot)
Properties:
foodList- Array of food items the bot will eat
Default Food List:
minecraft:cooked_beefminecraft:cooked_chickenminecraft:bread
Methods:
normalizeFoodName(foodName)- Addsminecraft:prefix if missingstartAutoEat()- Begins automatic eating looptryToEat()- Attempts to eat food from inventoryfindFoodInInventory()- Searches for consumable food
AutoTotem Class
Constructor: new AutoTotem(bot)
Properties:
lowHealthThreshold- Health level that triggers totem equipping (default: 10)offhandSlot- Off-hand inventory slot (default: 45)
Methods:
start()- Begins health monitoring and auto-equippinghandleAutoTotem()- Checks health and triggers totem equippingequipTotem()- Equips totem to off-handfindTotemInInventory()- Searches for totem in inventory
BotDeath Class
Constructor: new BotDeath(bot)
Methods:
getKillerWeapon(killer)- Gets the weapon used by a killersetupDeathHandler()- Sets up death event listener
Death Log Format:
[MM/DD/YYYY, HH:MM:SS AM/PM] The bot has died at [timestamp] at location: X: 100, Y: 64, Z: -200. Killed by player: Steve using diamond_sword.Configuration Examples
Custom Food List
const food = new Food(bot);
food.foodList = [
'minecraft:golden_apple',
'minecraft:cooked_porkchop',
'minecraft:steak'
];Custom Health Threshold
const autoTotem = new AutoTotem(bot);
autoTotem.lowHealthThreshold = 14; // Equip at 7 hearts
autoTotem.start();Output Files
death.txt- Contains timestamped death logs with location and killer information
Requirements
- Node.js
- Mineflayer
License
MIT
