nurtex 1.1.0

Library for creating Minecraft bots.
Documentation

Nurtex

This is a library written in Rust that allows you to create Minecraft bots and manage them, including connection and packet processing. This library focuses on an asynchronous environment, maximum speed and optimization, and ease of coding.

Supported Minecraft version: 1.21.11 (or protocol version - 774).

Features

  • Speed: All operations in this library work efficiently and are limited by timeouts.
  • Lightweight: Library is quite lightweight and does not have any unnecessary dependencies.
  • Swarm architecture: Allows you to work effectively with large groups of bots while consuming little RAM.
  • Cluster architecture: Allows you to simultaneously run swarms of bots on different servers (multi-target).
  • Flexibility: Library has flexible settings (relative to current capabilities).
  • Proxy support: Library supports connecting bots via SOCKS5 / SOCKS4 proxies.
  • Asynchrony: Library relies on an asynchronous environment.

Documentation

Русская | English

Examples

All current examples can be found here: browse

Create a bot

This is one of the simplest examples of creating and connecting a bot.

use nurtex::Bot;
use nurtex::bot::BotChatExt;

#[tokio::main]
async fn main() -> std::io::Result<()> {
  // Создаём бота
  let mut bot = Bot::create("nurtex_bot");

  // Подключаем бота к серверу
  bot.connect("localhost", 25565);

  // Ждём немножко
  tokio::time::sleep(std::time::Duration::from_secs(3)).await;

  // Отправляем сообщение в чат
  bot.chat_message("Привет, мир!").await?;

  // Ожидаем окончания хэндла подключения
  bot.wait_handle().await
}

Create a swarm

In this example, you can see a simple implementation of a bot swarm.

use nurtex::{Bot, JoinDelay, Swarm};

#[tokio::main]
async fn main() {
  // Создаём список ботов
  let mut bots = Vec::new();

  // Добавляем ботов в наш список
  for i in 0..6 {
    bots.push(Bot::create(format!("nurtex_bot_{}", i)));
  }

  // Создаём рой и запускаем его на сервер
  Swarm::create()
    .with_bots(bots)
    .set_join_delay(JoinDelay::fixed(500))
    .bind("localhost", 25565)
    .launch_and_wait()
    .await
}

Create a cluster

Here you can see a minimal example of creating a cluster.

use nurtex::{Bot, Cluster, JoinDelay, Swarm};

#[tokio::main]
async fn main() -> std::io::Result<()> {
  // Создаём список роев
  let mut swarms = Vec::new();

  // Создаём цикл на 3 повторения
  for s_ind in 0..3 {
    // Создаём рой
    let mut swarm = Swarm::create()
      .set_join_delay(JoinDelay::fixed(1000))
      .bind("localhost", 25565);

    // Создаём цикл на 2 повторения
    for b_ind in 0..2 {
      // Создаём бота и добавляем его в рой
      swarm.add_bot(Bot::create(format!("nurtex_{}_{}", s_ind, b_ind)));
    }

    // Добавляем рой в список
    swarms.push(swarm);
  }

  // Создаём кластер и сразу запускаем его
  Cluster::create()
    .with_swarms(swarms)
    .launch_and_wait()
    .await
}