fix: all clippy warns
This commit is contained in:
parent
ae69bbc7f1
commit
19af3618cb
@ -1,13 +1,15 @@
|
|||||||
use crate::{bytebuf::ByteBuffer, ClientPacket, KnownPack, VarInt};
|
use crate::{bytebuf::ByteBuffer, ClientPacket, Identifier, KnownPack, VarInt};
|
||||||
|
|
||||||
pub struct CCookieRequest {
|
pub struct CCookieRequest {
|
||||||
// TODO
|
key: Identifier,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ClientPacket for CCookieRequest {
|
impl ClientPacket for CCookieRequest {
|
||||||
const PACKET_ID: VarInt = 0x00;
|
const PACKET_ID: VarInt = 0x00;
|
||||||
|
|
||||||
fn write(&self, bytebuf: &mut ByteBuffer) {}
|
fn write(&self, bytebuf: &mut ByteBuffer) {
|
||||||
|
bytebuf.put_string(&self.key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct CPluginMessage<'a> {
|
pub struct CPluginMessage<'a> {
|
||||||
@ -115,7 +117,7 @@ impl<'a> ClientPacket for CRegistryData<'a> {
|
|||||||
fn write(&self, bytebuf: &mut ByteBuffer) {
|
fn write(&self, bytebuf: &mut ByteBuffer) {
|
||||||
bytebuf.put_string(self.registry_id);
|
bytebuf.put_string(self.registry_id);
|
||||||
bytebuf.put_list::<RegistryEntry>(self.entries, |p, v| {
|
bytebuf.put_list::<RegistryEntry>(self.entries, |p, v| {
|
||||||
p.put_string(&v.entry_id);
|
p.put_string(v.entry_id);
|
||||||
p.put_bool(!v.data.is_empty());
|
p.put_bool(!v.data.is_empty());
|
||||||
p.put_slice(&v.data);
|
p.put_slice(&v.data);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -58,25 +58,24 @@ pub struct CSetCompression {
|
|||||||
threshold: VarInt,
|
threshold: VarInt,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct CLoginSuccess {
|
pub struct CLoginSuccess<'a> {
|
||||||
pub uuid: uuid::Uuid,
|
pub uuid: uuid::Uuid,
|
||||||
pub username: String, // 16
|
pub username: String, // 16
|
||||||
pub num_of_props: VarInt,
|
pub properties: &'a [Property],
|
||||||
// pub property: Property,
|
|
||||||
pub strict_error_handling: bool,
|
pub strict_error_handling: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CLoginSuccess {
|
impl<'a> CLoginSuccess<'a> {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
uuid: uuid::Uuid,
|
uuid: uuid::Uuid,
|
||||||
username: String,
|
username: String,
|
||||||
num_of_props: VarInt,
|
properties: &'a [Property],
|
||||||
strict_error_handling: bool,
|
strict_error_handling: bool,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
uuid,
|
uuid,
|
||||||
username,
|
username,
|
||||||
num_of_props,
|
properties,
|
||||||
strict_error_handling,
|
strict_error_handling,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,14 +88,18 @@ pub struct Property {
|
|||||||
signature: Option<String>,
|
signature: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ClientPacket for CLoginSuccess {
|
impl<'a> ClientPacket for CLoginSuccess<'a> {
|
||||||
const PACKET_ID: VarInt = 0x02;
|
const PACKET_ID: VarInt = 0x02;
|
||||||
|
|
||||||
fn write(&self, bytebuf: &mut ByteBuffer) {
|
fn write(&self, bytebuf: &mut ByteBuffer) {
|
||||||
bytebuf.put_uuid(self.uuid);
|
bytebuf.put_uuid(self.uuid);
|
||||||
bytebuf.put_string(&self.username);
|
bytebuf.put_string(&self.username);
|
||||||
bytebuf.put_var_int(self.num_of_props);
|
bytebuf.put_list::<Property>(self.properties, |p, v| {
|
||||||
// Todo
|
p.put_string(&v.name);
|
||||||
|
p.put_string(&v.value);
|
||||||
|
p.put_bool(v.is_signed);
|
||||||
|
p.put_option(&v.signature, |p, v| p.put_string(v.as_str()))
|
||||||
|
});
|
||||||
bytebuf.put_bool(self.strict_error_handling);
|
bytebuf.put_bool(self.strict_error_handling);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -248,6 +248,7 @@ pub struct CChunkDataUpdateLight {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl CChunkDataUpdateLight {
|
impl CChunkDataUpdateLight {
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn new(
|
pub fn new(
|
||||||
chunk_x: i32,
|
chunk_x: i32,
|
||||||
chunk_y: i32,
|
chunk_y: i32,
|
||||||
|
|||||||
@ -55,7 +55,7 @@ impl ServerPacket for SAcknowledgeFinishConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct SKnownPacks {
|
pub struct SKnownPacks {
|
||||||
known_pack_count: VarInt,
|
pub known_pack_count: VarInt,
|
||||||
// known_packs: &'a [KnownPack]
|
// known_packs: &'a [KnownPack]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -41,9 +41,9 @@ impl ServerPacket for SEncryptionResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct SLoginPluginResponse<'a> {
|
pub struct SLoginPluginResponse<'a> {
|
||||||
message_id: VarInt,
|
pub message_id: VarInt,
|
||||||
successful: bool,
|
pub successful: bool,
|
||||||
data: Option<&'a [u8]>,
|
pub data: Option<&'a [u8]>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ServerPacket for SLoginPluginResponse<'a> {
|
impl<'a> ServerPacket for SLoginPluginResponse<'a> {
|
||||||
|
|||||||
@ -1,13 +1 @@
|
|||||||
use serde::Serialize;
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize)]
|
|
||||||
pub struct ChatType {
|
|
||||||
chat: Decoration,
|
|
||||||
narration: Decoration,
|
|
||||||
}
|
|
||||||
#[derive(Debug, Clone, Serialize)]
|
|
||||||
struct Decoration {
|
|
||||||
translation_key: String,
|
|
||||||
// style: Option<>
|
|
||||||
parameters: Vec<String>,
|
|
||||||
}
|
|
||||||
|
|||||||
@ -67,7 +67,7 @@ pub(super) fn entires() -> Vec<RegistryEntry<'static>> {
|
|||||||
let items: Vec<_> = NAMES
|
let items: Vec<_> = NAMES
|
||||||
.iter()
|
.iter()
|
||||||
.map(|name| RegistryEntry {
|
.map(|name| RegistryEntry {
|
||||||
entry_id: (*name).into(),
|
entry_id: name,
|
||||||
data: fastnbt::to_bytes_with_opts(
|
data: fastnbt::to_bytes_with_opts(
|
||||||
&DamageType {
|
&DamageType {
|
||||||
exhaustion: 0.1,
|
exhaustion: 0.1,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
use fastnbt::{nbt, SerOpts};
|
use fastnbt::nbt;
|
||||||
|
|
||||||
pub const BLOCKS_AND_BIOMES: [u8; 2000] = [0x80; 2000];
|
pub const BLOCKS_AND_BIOMES: [u8; 2000] = [0x80; 2000];
|
||||||
pub const SKY_LIGHT_ARRAYS: [FixedArray<u8, 2048>; 26] = [FixedArray([0xff; 2048]); 26];
|
pub const SKY_LIGHT_ARRAYS: [FixedArray<u8, 2048>; 26] = [FixedArray([0xff; 2048]); 26];
|
||||||
@ -11,6 +11,12 @@ pub struct TestChunk {
|
|||||||
pub heightmap: Vec<u8>,
|
pub heightmap: Vec<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for TestChunk {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl TestChunk {
|
impl TestChunk {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let bytes = fastnbt::to_bytes(&nbt!({"MOTION_BLOCKING": [L; 123, 256]})).unwrap();
|
let bytes = fastnbt::to_bytes(&nbt!({"MOTION_BLOCKING": [L; 123, 256]})).unwrap();
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use std::{fs::File, path::Path};
|
use std::{fs::File, path::Path};
|
||||||
|
|
||||||
use fastanvil::{complete, Chunk, Region};
|
use fastanvil::Region;
|
||||||
|
|
||||||
pub mod chunk;
|
pub mod chunk;
|
||||||
|
|
||||||
|
|||||||
@ -109,7 +109,7 @@ impl ClientPacketProcessor for Client {
|
|||||||
|
|
||||||
if let Some(uuid) = self.uuid {
|
if let Some(uuid) = self.uuid {
|
||||||
if let Some(name) = &self.name {
|
if let Some(name) = &self.name {
|
||||||
let packet = CLoginSuccess::new(uuid, name.clone(), 0, false);
|
let packet = CLoginSuccess::new(uuid, name.clone(), &[], false); // todo
|
||||||
self.send_packet(packet)
|
self.send_packet(packet)
|
||||||
.unwrap_or_else(|e| self.kick(&e.to_string()));
|
.unwrap_or_else(|e| self.kick(&e.to_string()));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -35,14 +35,14 @@ pub mod player_packet;
|
|||||||
use client_packet::ClientPacketProcessor;
|
use client_packet::ClientPacketProcessor;
|
||||||
|
|
||||||
pub struct PlayerConfig {
|
pub struct PlayerConfig {
|
||||||
locale: String, // 16
|
pub locale: String, // 16
|
||||||
view_distance: i8,
|
pub view_distance: i8,
|
||||||
chat_mode: ChatMode,
|
pub chat_mode: ChatMode,
|
||||||
chat_colors: bool,
|
pub chat_colors: bool,
|
||||||
skin_parts: u8,
|
pub skin_parts: u8,
|
||||||
main_hand: Hand,
|
pub main_hand: Hand,
|
||||||
text_filtering: bool,
|
pub text_filtering: bool,
|
||||||
server_listing: bool,
|
pub server_listing: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Client {
|
pub struct Client {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use pumpkin_protocol::server::play::SConfirmTeleport;
|
use pumpkin_protocol::server::play::SConfirmTeleport;
|
||||||
|
|
||||||
use crate::{entity::player::Player, server::Server};
|
use crate::server::Server;
|
||||||
|
|
||||||
use super::Client;
|
use super::Client;
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
use std::{
|
use std::{
|
||||||
io::Cursor,
|
io::Cursor,
|
||||||
rc::Rc,
|
|
||||||
sync::atomic::{AtomicI32, Ordering},
|
sync::atomic::{AtomicI32, Ordering},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -9,14 +8,11 @@ use mio::{event::Event, Poll};
|
|||||||
use pumpkin_protocol::{
|
use pumpkin_protocol::{
|
||||||
client::{
|
client::{
|
||||||
config::CPluginMessage,
|
config::CPluginMessage,
|
||||||
play::{CChunkDataUpdateLight, CGameEvent, CLogin, CSyncPlayerPostion, SkyLight},
|
play::{CChunkDataUpdateLight, CGameEvent, CLogin, CSyncPlayerPostion},
|
||||||
},
|
},
|
||||||
BitSet, PacketError, Players, Sample, StatusResponse, VarInt, VarInt32, Version,
|
BitSet, PacketError, Players, Sample, StatusResponse, VarInt, VarInt32, Version,
|
||||||
};
|
};
|
||||||
use pumpkin_world::{
|
use pumpkin_world::chunk::TestChunk;
|
||||||
chunk::{TestChunk, SKY_LIGHT_ARRAYS},
|
|
||||||
World,
|
|
||||||
};
|
|
||||||
use rsa::{rand_core::OsRng, traits::PublicKeyParts, RsaPrivateKey, RsaPublicKey};
|
use rsa::{rand_core::OsRng, traits::PublicKeyParts, RsaPrivateKey, RsaPublicKey};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user