mineflayer-melee
v0.0.2
Published
Simulate realistic player combat with mineflayer
Downloads
5
Readme
Features
- Simulate realistic player combat with minimal anticheat risk
- Built-in entity hitbox and block collision detection
- Smooth yaw/pitch rotations and no head snapping
Installation
# using the node package manager:
npm install mineflayer-melee
Usage
Loading the Plugin
const mineflayer = require("mineflayer")
const melee = require("mineflayer-melee")
const plugin = melee.getPlugin( ... )
const bot = mineflayer.createBot( ... )
bot.loadPlugin(plugin)
Configuration
/*
On any given bot.melee.swing():
*/
const options = {
velocity: number, // (Units: Radians) Maximum angular velocity
acceleration: number, // (Units: Radians) Increase in angular velocity
chance: number, // (0 < chance < 1) How often to actually swing
range: number // Maximum range to attack entities
}
const plugin = melee.getPlugin(options)
API
/*
Adjusts the player's aim, and attempts to attack an entity. Swings the sword if the attack missed.
*/
bot.melee.swing(entity, hand)
/*
Resets the player's stored angular velocity
*/
bot.melee.reset()
Example
/*
Recommended to execute every tick for the best result
*/
bot.on("physicsTick", () => {
const entity = bot.nearestEntity(entity => entity.type === "player")
if (entity) bot.melee.swing(entity)
})