nurtex-0.1.0 has been yanked.
NurtexMC
NurtexMC 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).
Usage
To use this library in your code, add a dependency to the Cargo.toml:
nurtex = { git = "https://github.com/nullclyze/NurtexMC" }
Examples
Creating a bot
use std::io;
use nurtex::core::bot::Bot;
use nurtex::utils::sleep;
#[tokio::main]
async fn main() -> io::Result<()> {
let (mut bot, terminal) = Bot::new("NurtexBot");
tokio::spawn(async move {
sleep(3000).await;
terminal.chat("Hello, world!").await;
sleep(5000).await;
terminal.disconnect().await;
});
bot.connect_to("localhost", 25565).await?;
Ok(())
}
Creating a swarm
use std::io;
use nurtex::{create_shared_swarm, launch_shared_swarm};
use nurtex::core::bot::BotCommand;
use nurtex::core::swarm::SwarmObject;
use nurtex::utils::sleep;
#[tokio::main]
async fn main() -> io::Result<()> {
let mut objects = Vec::new();
for i in 0..4 {
let object = SwarmObject::new(format!("bot_{}", i));
objects.push(object);
}
let swarm = create_shared_swarm(objects);
launch_shared_swarm(swarm.clone(), "localhost".to_string(), 25565, 500);
sleep(4000).await;
swarm.read().await.send(BotCommand::Chat("Hello, world!".to_string())).await;
sleep(5000).await;
swarm.write().await.destroy().await;
Ok(())
}