update to 26.1

This commit is contained in:
Alexander Medvedev 2026-04-19 21:28:35 +02:00
parent e4fa37f2c9
commit a7296b4522
4 changed files with 347 additions and 466 deletions

768
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -10,15 +10,15 @@ codegen-units = 1
[dependencies]
# log
log = "0.4"
simple_logger = "5.1.0"
simple_logger = "5.2.0"
# CLI
clap = { version = "4.5.56", features = ["derive"] }
clap = { version = "4.6.1", features = ["derive"] }
# Networking
tokio = { version = "1.49.0", features = ["net", "io-util"] }
tokio = { version = "1.52.1", features = ["net", "io-util"] }
pumpkin-protocol = { git = "https://github.com/Pumpkin-MC/Pumpkin", package = "pumpkin-protocol", default-features = false, features = ["serverbound", "clientbound"]}
pumpkin-util = { git = "https://github.com/Pumpkin-MC/Pumpkin", package = "pumpkin-util"}
pumpkin-data = { git = "https://github.com/Pumpkin-MC/Pumpkin", package = "pumpkin-data"}
crossbeam = "0.8.4"
uuid = "1.20.0"
uuid = "1.23.1"
rand = { git = "https://github.com/rust-random/rand"}

View File

@ -1,7 +1,7 @@
<div align="center">
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![Current version)](https://img.shields.io/badge/current_version-1.21.11-blue)
![Current version)](https://img.shields.io/badge/current_version-1.26-blue)
A tool to stress test Minecraft servers by simulating numerous bot connections, helping identify performance bottlenecks and stability issues.
![Screenshot_20250223_154536](https://github.com/user-attachments/assets/b1379060-e375-44dc-95a3-91f1f2fb52dd)

View File

@ -1,5 +1,4 @@
use crossbeam::atomic::AtomicCell;
use pumpkin_data::packet::CURRENT_MC_PROTOCOL;
use pumpkin_protocol::codec::var_int::VarInt;
use pumpkin_protocol::java::client::config::{CConfigDisconnect, CFinishConfig};
use pumpkin_protocol::java::client::login::{
@ -42,6 +41,8 @@ use uuid::Uuid;
use crate::Args;
pub const VERSION: MinecraftVersion = MinecraftVersion::V_26_1;
/// Everything which makes a Connection with our Server is a `Client`.
#[expect(dead_code)]
pub struct Client {
@ -387,8 +388,8 @@ impl Client {
write: impl Write,
) -> Result<(), WritingError> {
let mut write = write;
write.write_var_int(&VarInt(P::PACKET_ID.latest_id))?;
packet.write_packet_data(write, &MinecraftVersion::V_1_21_11)
write.write_var_int(&VarInt(P::to_id(VERSION)))?;
packet.write_packet_data(write, &VERSION)
}
/// Sends a clientbound packet to the connected client.
@ -419,7 +420,7 @@ impl Client {
pub async fn join_server(&self, address: SocketAddr, name: String) {
self.send_packet(&SHandShake {
protocol_version: VarInt(CURRENT_MC_PROTOCOL as i32),
protocol_version: VarInt(VERSION.protocol_version()),
server_address: address.ip().to_string(),
server_port: address.port(),
next_state: pumpkin_protocol::ConnectionState::Login,
@ -448,20 +449,20 @@ impl Client {
async fn handle_login_packet(&self, packet: &mut RawPacket) -> Result<(), ReadingError> {
let bytebuf = &packet.payload[..];
match packet.id {
id if id == CEncryptionRequest::PACKET_ID => {
id if id == CEncryptionRequest::to_id(VERSION) => {
todo!("Encryption is currently not implemented, please disable it at server level")
}
id if id == CSetCompression::PACKET_ID => {
id if id == CSetCompression::to_id(VERSION) => {
log::trace!("Set Compression");
let packet = CSetCompression::read(bytebuf)?;
let packet = CSetCompression::read(bytebuf, &VERSION)?;
self.set_compression(Some((packet.threshold.0 as usize, 6)))
.await
}
id if id == CLoginDisconnect::PACKET_ID => {
id if id == CLoginDisconnect::to_id(VERSION) => {
log::error!("Kicking in Login State");
self.close().await;
}
id if id == CLoginSuccess::PACKET_ID => {
id if id == CLoginSuccess::to_id(VERSION) => {
log::trace!("Login -> Config");
self.send_packet(&SLoginAcknowledged).await;
self.connection_state.store(ConnectionState::Config);
@ -478,11 +479,11 @@ impl Client {
async fn handle_config_packet(&self, packet: &mut RawPacket) -> Result<(), ReadingError> {
match packet.id {
id if id == CConfigDisconnect::PACKET_ID => {
id if id == CConfigDisconnect::to_id(VERSION) => {
log::error!("Kicking in Config State");
self.close().await;
}
id if id == CFinishConfig::PACKET_ID => {
id if id == CFinishConfig::to_id(VERSION) => {
log::trace!("Config -> Play");
self.send_packet(&SAcknowledgeFinishConfig).await;
self.connection_state.store(ConnectionState::Play);
@ -495,8 +496,8 @@ impl Client {
async fn handle_play_packet(&self, packet: &mut RawPacket) -> Result<(), ReadingError> {
let bytebuf = &packet.payload[..];
match packet.id {
id if id == CKeepAlive::PACKET_ID => {
let packet = CKeepAlive::read(bytebuf)?;
id if id == CKeepAlive::to_id(VERSION) => {
let packet = CKeepAlive::read(bytebuf, &VERSION)?;
self.send_packet(&SKeepAlive {
keep_alive_id: packet.keep_alive_id,
})
@ -512,8 +513,8 @@ impl Client {
// self.velocity_z.store(packet.velocity.0.z as f64 / 8000.0);
// }
// }
id if id == CPlayerPosition::PACKET_ID => {
let packet = CPlayerPosition::read(bytebuf)?;
id if id == CPlayerPosition::to_id(VERSION) => {
let packet = CPlayerPosition::read(bytebuf, &VERSION)?;
self.current_yaw.store(packet.yaw);
self.current_pitch.store(packet.pitch);
@ -539,14 +540,14 @@ impl Client {
.await;
self.is_loaded.store(true, Ordering::Relaxed);
}
id if id == CLogin::PACKET_ID => {
id if id == CLogin::to_id(VERSION) => {
// TODO
// let packet = CLogin::read(bytebuf)?;
// self.entity_id.store(packet.entity_id, Ordering::Relaxed);
self.send_packet(&SPlayerLoaded).await;
}
id if id == CPlayDisconnect::PACKET_ID => {
id if id == CPlayDisconnect::to_id(VERSION) => {
log::error!("Kicking in Play State");
self.close().await;
}