update to 26.1
This commit is contained in:
parent
e4fa37f2c9
commit
a7296b4522
768
Cargo.lock
generated
768
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -10,15 +10,15 @@ codegen-units = 1
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
# log
|
# log
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
simple_logger = "5.1.0"
|
simple_logger = "5.2.0"
|
||||||
# CLI
|
# CLI
|
||||||
clap = { version = "4.5.56", features = ["derive"] }
|
clap = { version = "4.6.1", features = ["derive"] }
|
||||||
# Networking
|
# 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-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-util = { git = "https://github.com/Pumpkin-MC/Pumpkin", package = "pumpkin-util"}
|
||||||
pumpkin-data = { git = "https://github.com/Pumpkin-MC/Pumpkin", package = "pumpkin-data"}
|
pumpkin-data = { git = "https://github.com/Pumpkin-MC/Pumpkin", package = "pumpkin-data"}
|
||||||
|
|
||||||
crossbeam = "0.8.4"
|
crossbeam = "0.8.4"
|
||||||
uuid = "1.20.0"
|
uuid = "1.23.1"
|
||||||
rand = { git = "https://github.com/rust-random/rand"}
|
rand = { git = "https://github.com/rust-random/rand"}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
[](https://opensource.org/licenses/MIT)
|
[](https://opensource.org/licenses/MIT)
|
||||||

|

|
||||||
|
|
||||||
A tool to stress test Minecraft servers by simulating numerous bot connections, helping identify performance bottlenecks and stability issues.
|
A tool to stress test Minecraft servers by simulating numerous bot connections, helping identify performance bottlenecks and stability issues.
|
||||||

|

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