1.7.6 • Published 8 months ago

@nxg-org/mineflayer-custom-pvp v1.7.6

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
8 months ago

Mineflayer Advanced PvP

Enhanced combat capabilities for Mineflayer bots

License Minecraft Discord


Overview

This plugin enhances Mineflayer bots with advanced PvP capabilities through two specialized modules:

  • SwordPvP: Melee combat with intelligent criticals, strafing, and shield management
  • BowPvP: Ranged combat with improved projectile prediction and tactical awareness

Both modules extend existing plugins (mineflayer-pvp and minecrafthawkeye) with significant improvements and new features.


The SwordPvP module delivers accurate melee combat with features designed to match the effectiveness of modern PvP clients.

Key Features

  • MC-Accurate Hit Detection

    • Precise AABB collision models with eye-height projection
    • Matches Minecraft's actual hit detection mechanics
    • Improved hit registration compared to foot-position calculations
  • Advanced Critical Attacks

    • Achieves 80-100% critical hit rate depending on movement patterns
    • Multiple critical modes: hop, packet, and reactive timing
    • Packet-based criticals use optimized parameters based on popular clients
  • Intelligent Shield Handling

    • Automatic shield detection and countering
    • Weapon switching to axes when opponents shield
    • Both "legit" and "blatant" shielding modes
  • Tactical Movement

    • Multiple strafing patterns: circle, random, and intelligent
    • Sprint-tapping techniques for knockback manipulation
    • Automatic distance management
  • Enhanced Tracking

    • Precision target following with direct look commands
    • Multiple rotation modes: constant, silent, and instant
    • Option to predict target movement

Effectiveness

  • 80-95% critical hit rate during active combat
  • Near 100% critical success against stationary targets
  • Automatic tactical adaptation based on opponent behavior

The BowPvP module enhances ranged combat with improved targeting and tactical awareness features.

Key Features

  • Optimized Targeting

    • Body-centered aim for higher hit probability
    • Improved projectile physics models
  • Shot Prediction

    • Calculate trajectory between any two entities
    • Accurately predict endpoints of shots from any loaded entity
    • Determine hit probability for tactical decisions
  • Combat Awareness

    • Detection when the bot is being aimed at
    • Real-time threat assessment

Installation

npm install mineflayer-advanced-pvp

Basic Usage

const mineflayer = require('mineflayer')
const customPVP = require('mineflayer-advanced-pvp')
const { pathfinder, Movements } = require('mineflayer-pathfinder')

// Create your bot
const bot = mineflayer.createBot({
  host: 'localhost',
  username: 'CombatBot'
})

// Load plugins
bot.loadPlugin(customPVP)
bot.loadPlugin(pathfinder)

// Configure pathfinder movements
const moves = new Movements(bot)
moves.allowFreeMotion = true
moves.allowParkour = true
moves.allowSprinting = true
bot.pathfinder.setMovements(moves)

// The plugin adds bot.swordpvp and bot.bowpvp
bot.once('spawn', () => {
  // Configure combat options
  bot.swordpvp.options.cps = 20
  bot.swordpvp.options.critConfig.reaction.enabled = false
  bot.swordpvp.options.rotateConfig.smooth = true
  
  // Configure bow combat
  bot.bowpvp.useOffhand = false
  
  // Track attacks
  bot.swordpvp.on('attackedTarget', (target, reason, ticks) => {
    console.log(`Attack: ${reason}, next attack in ${ticks} ticks`)
  })
})

// Function to start fighting
const fight = () => {
  const target = bot.nearestEntity(e => e.type === 'player')
  if (target) {
    // Equip shield if available
    equipShield()
    // Start attacking
    bot.swordpvp.attack(target)
  }
}

// Helper to equip shield
async function equipShield() {
  if (bot.supportFeature('doesntHaveOffHandSlot')) return
  const shield = bot.util.inv.getAllItemsExceptCurrent('off-hand').find(e => e.name === 'shield')
  if (shield) {
    await bot.util.inv.customEquip(shield, 'off-hand')
  }
}

// Command handler
bot.on('chat', (username, message) => {
  switch (message) {
    case 'sword':
      bot.on('physicsTick', fight)
      break
    
    case 'stop':
      bot.removeListener('physicsTick', fight)
      bot.swordpvp.stop()
      break
      
    case 'packetmode':
      bot.swordpvp.options.critConfig.mode = 'packet'
      break
  }
})

Advanced Configuration

// Configure SwordPvP options
bot.once('spawn', () => {
  // Attack speed
  bot.swordpvp.options.cps = 20
  
  // Critical hit configuration
  bot.swordpvp.options.critConfig.enabled = true
  bot.swordpvp.options.critConfig.mode = 'packet'
  bot.swordpvp.options.critConfig.reaction.enabled = false
  
  // Follow configuration
  bot.swordpvp.options.followConfig.mode = 'jump'
  
  // Strafing configuration
  bot.swordpvp.options.strafeConfig.enabled = true
  bot.swordpvp.options.strafeConfig.mode.mode = 'intelligent'
  
  // Tap configuration for knockback
  bot.swordpvp.options.tapConfig.enabled = true
  bot.swordpvp.options.tapConfig.mode = 'wtap'
  
  // Look behavior
  bot.swordpvp.options.rotateConfig.smooth = true
  bot.swordpvp.options.rotateConfig.mode = 'constant'
})

For complete API documentation including all configuration options, methods, properties, and events, see the SwordPvP API Documentation.


Future Development

  • Expanded shield mechanics with proper movement penalties
  • Additional combat styles and strategies
  • Further optimization for server-specific combat mechanics

If you're interested in crystal PvP, check out mineflayer-auto-crystal.

Support

Need help? Join our Discord community for support, discussions, and updates.

Credits

1.7.6

8 months ago

1.7.5

8 months ago

1.6.13

8 months ago

1.7.4

8 months ago

1.6.12

8 months ago

1.6.14

8 months ago

1.6.11

1 year ago

1.6.10

1 year ago

1.4.6

3 years ago

1.7.2

3 years ago

1.6.3

3 years ago

1.4.5

3 years ago

1.7.1

3 years ago

1.6.2

3 years ago

1.4.4

3 years ago

1.7.0

3 years ago

1.6.1

3 years ago

1.4.3

3 years ago

1.6.0

3 years ago

1.4.2

3 years ago

1.5.0

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.6.9

3 years ago

1.6.7

3 years ago

1.4.9

3 years ago

1.6.6

3 years ago

1.4.8

3 years ago

1.6.5

3 years ago

1.4.7

3 years ago

1.3.8

4 years ago

1.3.7

4 years ago

1.3.6

4 years ago

1.3.5

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago