Some Refactors
This commit is contained in:
1 parent
97065617b6
commit
466d4380cf
210 files changed
+491
-386
No files matched your search
@@ -1,7 +1,7 @@
|
||||
use pumpkin_registry::{
|
||||
flatten_3x3, get_tag_values, IngredientSlot, IngredientType, RecipeResult, TagCategory, RECIPES,
|
||||
};
|
||||
use pumpkin_world::item::item_registry::get_item;
|
||||
use pumpkin_world::item::registry::get_item;
|
||||
use pumpkin_world::item::ItemStack;
|
||||
use rayon::prelude::*;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::crafting::check_if_matches_crafting;
|
||||
use crate::Container;
|
||||
use pumpkin_data::screen::WindowType;
|
||||
use pumpkin_util::math::position::BlockPos;
|
||||
use pumpkin_world::block::block_registry::Block;
|
||||
use pumpkin_world::block::registry::Block;
|
||||
use pumpkin_world::item::ItemStack;
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
@@ -78,7 +78,7 @@ pub fn client_packet(input: TokenStream, item: TokenStream) -> TokenStream {
|
||||
|
||||
let gen = quote! {
|
||||
#item
|
||||
impl #impl_generics crate::bytebuf::packet_id::Packet for #name #ty_generics {
|
||||
impl #impl_generics crate::bytebuf::packet::Packet for #name #ty_generics {
|
||||
const PACKET_ID: i32 = #input;
|
||||
}
|
||||
};
|
||||
@@ -97,7 +97,7 @@ pub fn server_packet(input: TokenStream, item: TokenStream) -> TokenStream {
|
||||
|
||||
let gen = quote! {
|
||||
#item
|
||||
impl #impl_generics crate::bytebuf::packet_id::Packet for #name #ty_generics {
|
||||
impl #impl_generics crate::bytebuf::packet::Packet for #name #ty_generics {
|
||||
const PACKET_ID: i32 = #input;
|
||||
}
|
||||
};
|
||||
@@ -131,6 +131,32 @@ pub fn pumpkin_block(input: TokenStream, item: TokenStream) -> TokenStream {
|
||||
gen.into()
|
||||
}
|
||||
|
||||
#[proc_macro_attribute]
|
||||
pub fn pumpkin_item(input: TokenStream, item: TokenStream) -> TokenStream {
|
||||
let ast: syn::DeriveInput = syn::parse(item.clone()).unwrap();
|
||||
let name = &ast.ident;
|
||||
let (impl_generics, ty_generics, _) = ast.generics.split_for_impl();
|
||||
|
||||
let input_string = input.to_string();
|
||||
let packet_name = input_string.trim_matches('"');
|
||||
let packet_name_split: Vec<&str> = packet_name.split(":").collect();
|
||||
|
||||
let namespace = packet_name_split[0];
|
||||
let id = packet_name_split[1];
|
||||
|
||||
let item: proc_macro2::TokenStream = item.into();
|
||||
|
||||
let gen = quote! {
|
||||
#item
|
||||
impl #impl_generics crate::block::pumpkin_block::BlockMetadata for #name #ty_generics {
|
||||
const NAMESPACE: &'static str = #namespace;
|
||||
const ID: &'static str = #id;
|
||||
}
|
||||
};
|
||||
|
||||
gen.into()
|
||||
}
|
||||
|
||||
mod block_state;
|
||||
#[proc_macro]
|
||||
pub fn block_state(item: TokenStream) -> TokenStream {
|
||||
|
||||
@@ -11,7 +11,7 @@ use bytes::{Buf, BufMut};
|
||||
|
||||
mod deserializer;
|
||||
use thiserror::Error;
|
||||
pub mod packet_id;
|
||||
pub mod packet;
|
||||
mod serializer;
|
||||
|
||||
use std::mem::size_of;
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,21 +1,21 @@
|
||||
mod c_add_resource_pack;
|
||||
mod c_config_disconnect;
|
||||
mod c_cookie_request;
|
||||
mod c_finish_config;
|
||||
mod c_known_packs;
|
||||
mod c_plugin_message;
|
||||
mod c_registry_data;
|
||||
mod c_server_links;
|
||||
mod c_store_cookie;
|
||||
mod c_transfer;
|
||||
mod add_resource_pack;
|
||||
mod config_disconnect;
|
||||
mod cookie_request;
|
||||
mod finish_config;
|
||||
mod known_packs;
|
||||
mod plugin_message;
|
||||
mod registry_data;
|
||||
mod server_links;
|
||||
mod store_cookie;
|
||||
mod transfer;
|
||||
|
||||
pub use c_add_resource_pack::*;
|
||||
pub use c_config_disconnect::*;
|
||||
pub use c_cookie_request::*;
|
||||
pub use c_finish_config::*;
|
||||
pub use c_known_packs::*;
|
||||
pub use c_plugin_message::*;
|
||||
pub use c_registry_data::*;
|
||||
pub use c_server_links::*;
|
||||
pub use c_store_cookie::*;
|
||||
pub use c_transfer::*;
|
||||
pub use add_resource_pack::*;
|
||||
pub use config_disconnect::*;
|
||||
pub use cookie_request::*;
|
||||
pub use finish_config::*;
|
||||
pub use known_packs::*;
|
||||
pub use plugin_message::*;
|
||||
pub use registry_data::*;
|
||||
pub use server_links::*;
|
||||
pub use store_cookie::*;
|
||||
pub use transfer::*;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,13 +1,13 @@
|
||||
mod c_cookie_request;
|
||||
mod c_encryption_request;
|
||||
mod c_login_disconnect;
|
||||
mod c_login_success;
|
||||
mod c_plugin_request;
|
||||
mod c_set_compression;
|
||||
mod cookie_request;
|
||||
mod encryption_request;
|
||||
mod login_disconnect;
|
||||
mod login_success;
|
||||
mod plugin_request;
|
||||
mod set_compression;
|
||||
|
||||
pub use c_cookie_request::*;
|
||||
pub use c_encryption_request::*;
|
||||
pub use c_login_disconnect::*;
|
||||
pub use c_login_success::*;
|
||||
pub use c_plugin_request::*;
|
||||
pub use c_set_compression::*;
|
||||
pub use cookie_request::*;
|
||||
pub use encryption_request::*;
|
||||
pub use login_disconnect::*;
|
||||
pub use login_success::*;
|
||||
pub use plugin_request::*;
|
||||
pub use set_compression::*;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,147 +1,147 @@
|
||||
mod acknowledge_block;
|
||||
mod actionbar;
|
||||
mod block_destroy_stage;
|
||||
mod block_event;
|
||||
mod block_update;
|
||||
mod boss_event;
|
||||
mod bossevent_action;
|
||||
mod c_acknowledge_block;
|
||||
mod c_actionbar;
|
||||
mod c_block_destroy_stage;
|
||||
mod c_block_event;
|
||||
mod c_block_update;
|
||||
mod c_boss_event;
|
||||
mod c_center_chunk;
|
||||
mod c_change_difficulty;
|
||||
mod c_chunk_data;
|
||||
mod c_clear_title;
|
||||
mod c_close_container;
|
||||
mod c_combat_death;
|
||||
mod c_command_suggestions;
|
||||
mod c_commands;
|
||||
mod c_cookie_request;
|
||||
mod c_damage_event;
|
||||
mod c_disguised_chat_message;
|
||||
mod c_display_objective;
|
||||
mod c_entity_animation;
|
||||
mod c_entity_metadata;
|
||||
mod c_entity_sound_effect;
|
||||
mod c_entity_status;
|
||||
mod c_entity_velocity;
|
||||
mod c_game_event;
|
||||
mod c_head_rot;
|
||||
mod c_hurt_animation;
|
||||
mod c_initialize_world_border;
|
||||
mod c_keep_alive;
|
||||
mod c_level_event;
|
||||
mod c_login;
|
||||
mod c_open_screen;
|
||||
mod c_particle;
|
||||
mod c_ping_response;
|
||||
mod c_play_disconnect;
|
||||
mod c_player_abilities;
|
||||
mod c_player_chat_message;
|
||||
mod c_player_info_update;
|
||||
mod c_player_position;
|
||||
mod c_player_remove;
|
||||
mod c_remove_entities;
|
||||
mod c_reset_score;
|
||||
mod c_respawn;
|
||||
mod c_server_links;
|
||||
mod c_set_border_center;
|
||||
mod c_set_border_lerp_size;
|
||||
mod c_set_border_size;
|
||||
mod c_set_border_warning_delay;
|
||||
mod c_set_border_warning_distance;
|
||||
mod c_set_container_content;
|
||||
mod c_set_container_property;
|
||||
mod c_set_container_slot;
|
||||
mod c_set_experience;
|
||||
mod c_set_health;
|
||||
mod c_set_held_item;
|
||||
mod c_set_time;
|
||||
mod c_set_title;
|
||||
mod c_sound_effect;
|
||||
mod c_spawn_entity;
|
||||
mod c_store_cookie;
|
||||
mod c_subtitle;
|
||||
mod c_system_chat_message;
|
||||
mod c_take_item;
|
||||
mod c_teleport_entity;
|
||||
mod c_transfer;
|
||||
mod c_unload_chunk;
|
||||
mod c_update_entity_pos;
|
||||
mod c_update_entity_pos_rot;
|
||||
mod c_update_entity_rot;
|
||||
mod c_update_objectives;
|
||||
mod c_update_score;
|
||||
mod c_worldevent;
|
||||
mod center_chunk;
|
||||
mod change_difficulty;
|
||||
mod chunk_data;
|
||||
mod clear_title;
|
||||
mod close_container;
|
||||
mod combat_death;
|
||||
mod command_suggestions;
|
||||
mod commands;
|
||||
mod cookie_request;
|
||||
mod damage_event;
|
||||
mod disconnect;
|
||||
mod disguised_chat_message;
|
||||
mod display_objective;
|
||||
mod entity_animation;
|
||||
mod entity_metadata;
|
||||
mod entity_sound_effect;
|
||||
mod entity_status;
|
||||
mod entity_velocity;
|
||||
mod game_event;
|
||||
mod head_rot;
|
||||
mod hurt_animation;
|
||||
mod initialize_world_border;
|
||||
mod keep_alive;
|
||||
mod level_event;
|
||||
mod login;
|
||||
mod open_screen;
|
||||
mod particle;
|
||||
mod ping_response;
|
||||
mod player_abilities;
|
||||
mod player_action;
|
||||
mod player_chat_message;
|
||||
mod player_info_update;
|
||||
mod player_position;
|
||||
mod player_remove;
|
||||
mod remove_entities;
|
||||
mod reset_score;
|
||||
mod respawn;
|
||||
mod server_links;
|
||||
mod set_border_center;
|
||||
mod set_border_lerp_size;
|
||||
mod set_border_size;
|
||||
mod set_border_warning_delay;
|
||||
mod set_border_warning_distance;
|
||||
mod set_container_content;
|
||||
mod set_container_property;
|
||||
mod set_container_slot;
|
||||
mod set_experience;
|
||||
mod set_health;
|
||||
mod set_held_item;
|
||||
mod set_time;
|
||||
mod set_title;
|
||||
mod sound_effect;
|
||||
mod spawn_entity;
|
||||
mod store_cookie;
|
||||
mod subtitle;
|
||||
mod system_chat_message;
|
||||
mod take_item;
|
||||
mod teleport_entity;
|
||||
mod transfer;
|
||||
mod unload_chunk;
|
||||
mod update_entity_pos;
|
||||
mod update_entity_pos_rot;
|
||||
mod update_entity_rot;
|
||||
mod update_objectives;
|
||||
mod update_score;
|
||||
mod worldevent;
|
||||
|
||||
pub use acknowledge_block::*;
|
||||
pub use actionbar::*;
|
||||
pub use block_destroy_stage::*;
|
||||
pub use block_event::*;
|
||||
pub use block_update::*;
|
||||
pub use boss_event::*;
|
||||
pub use bossevent_action::*;
|
||||
pub use c_acknowledge_block::*;
|
||||
pub use c_actionbar::*;
|
||||
pub use c_block_destroy_stage::*;
|
||||
pub use c_block_event::*;
|
||||
pub use c_block_update::*;
|
||||
pub use c_boss_event::*;
|
||||
pub use c_center_chunk::*;
|
||||
pub use c_change_difficulty::*;
|
||||
pub use c_chunk_data::*;
|
||||
pub use c_clear_title::*;
|
||||
pub use c_close_container::*;
|
||||
pub use c_combat_death::*;
|
||||
pub use c_command_suggestions::*;
|
||||
pub use c_commands::*;
|
||||
pub use c_cookie_request::*;
|
||||
pub use c_damage_event::*;
|
||||
pub use c_disguised_chat_message::*;
|
||||
pub use c_display_objective::*;
|
||||
pub use c_entity_animation::*;
|
||||
pub use c_entity_metadata::*;
|
||||
pub use c_entity_sound_effect::*;
|
||||
pub use c_entity_status::*;
|
||||
pub use c_entity_velocity::*;
|
||||
pub use c_game_event::*;
|
||||
pub use c_head_rot::*;
|
||||
pub use c_hurt_animation::*;
|
||||
pub use c_initialize_world_border::*;
|
||||
pub use c_keep_alive::*;
|
||||
pub use c_level_event::*;
|
||||
pub use c_login::*;
|
||||
pub use c_open_screen::*;
|
||||
pub use c_particle::*;
|
||||
pub use c_ping_response::*;
|
||||
pub use c_play_disconnect::*;
|
||||
pub use c_player_abilities::*;
|
||||
pub use c_player_chat_message::*;
|
||||
pub use c_player_info_update::*;
|
||||
pub use c_player_position::*;
|
||||
pub use c_player_remove::*;
|
||||
pub use c_remove_entities::*;
|
||||
pub use c_reset_score::*;
|
||||
pub use c_respawn::*;
|
||||
pub use c_server_links::*;
|
||||
pub use c_set_border_center::*;
|
||||
pub use c_set_border_lerp_size::*;
|
||||
pub use c_set_border_size::*;
|
||||
pub use c_set_border_warning_delay::*;
|
||||
pub use c_set_border_warning_distance::*;
|
||||
pub use c_set_container_content::*;
|
||||
pub use c_set_container_property::*;
|
||||
pub use c_set_container_slot::*;
|
||||
pub use c_set_experience::*;
|
||||
pub use c_set_health::*;
|
||||
pub use c_set_held_item::*;
|
||||
pub use c_set_time::*;
|
||||
pub use c_set_title::*;
|
||||
pub use c_sound_effect::*;
|
||||
pub use c_spawn_entity::*;
|
||||
pub use c_store_cookie::*;
|
||||
pub use c_subtitle::*;
|
||||
pub use c_system_chat_message::*;
|
||||
pub use c_take_item::*;
|
||||
pub use c_teleport_entity::*;
|
||||
pub use c_transfer::*;
|
||||
pub use c_unload_chunk::*;
|
||||
pub use c_update_entity_pos::*;
|
||||
pub use c_update_entity_pos_rot::*;
|
||||
pub use c_update_entity_rot::*;
|
||||
pub use c_update_objectives::*;
|
||||
pub use c_update_score::*;
|
||||
pub use c_worldevent::*;
|
||||
pub use center_chunk::*;
|
||||
pub use change_difficulty::*;
|
||||
pub use chunk_data::*;
|
||||
pub use clear_title::*;
|
||||
pub use close_container::*;
|
||||
pub use combat_death::*;
|
||||
pub use command_suggestions::*;
|
||||
pub use commands::*;
|
||||
pub use cookie_request::*;
|
||||
pub use damage_event::*;
|
||||
pub use disconnect::*;
|
||||
pub use disguised_chat_message::*;
|
||||
pub use display_objective::*;
|
||||
pub use entity_animation::*;
|
||||
pub use entity_metadata::*;
|
||||
pub use entity_sound_effect::*;
|
||||
pub use entity_status::*;
|
||||
pub use entity_velocity::*;
|
||||
pub use game_event::*;
|
||||
pub use head_rot::*;
|
||||
pub use hurt_animation::*;
|
||||
pub use initialize_world_border::*;
|
||||
pub use keep_alive::*;
|
||||
pub use level_event::*;
|
||||
pub use login::*;
|
||||
pub use open_screen::*;
|
||||
pub use particle::*;
|
||||
pub use ping_response::*;
|
||||
pub use player_abilities::*;
|
||||
pub use player_action::*;
|
||||
pub use player_chat_message::*;
|
||||
pub use player_info_update::*;
|
||||
pub use player_position::*;
|
||||
pub use player_remove::*;
|
||||
pub use remove_entities::*;
|
||||
pub use reset_score::*;
|
||||
pub use respawn::*;
|
||||
pub use server_links::*;
|
||||
pub use set_border_center::*;
|
||||
pub use set_border_lerp_size::*;
|
||||
pub use set_border_size::*;
|
||||
pub use set_border_warning_delay::*;
|
||||
pub use set_border_warning_distance::*;
|
||||
pub use set_container_content::*;
|
||||
pub use set_container_property::*;
|
||||
pub use set_container_slot::*;
|
||||
pub use set_experience::*;
|
||||
pub use set_health::*;
|
||||
pub use set_held_item::*;
|
||||
pub use set_time::*;
|
||||
pub use set_title::*;
|
||||
pub use sound_effect::*;
|
||||
pub use spawn_entity::*;
|
||||
pub use store_cookie::*;
|
||||
pub use subtitle::*;
|
||||
pub use system_chat_message::*;
|
||||
pub use take_item::*;
|
||||
pub use teleport_entity::*;
|
||||
pub use transfer::*;
|
||||
pub use unload_chunk::*;
|
||||
pub use update_entity_pos::*;
|
||||
pub use update_entity_pos_rot::*;
|
||||
pub use update_entity_rot::*;
|
||||
pub use update_objectives::*;
|
||||
pub use update_score::*;
|
||||
pub use worldevent::*;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,5 +1,5 @@
|
||||
mod c_ping_response;
|
||||
mod c_status_response;
|
||||
mod ping_response;
|
||||
mod status_response;
|
||||
|
||||
pub use c_ping_response::*;
|
||||
pub use c_status_response::*;
|
||||
pub use ping_response::*;
|
||||
pub use status_response::*;
|
||||
File renamed without changes.
File renamed without changes.
@@ -1,6 +1,6 @@
|
||||
use std::num::NonZeroU16;
|
||||
|
||||
use bytebuf::{packet_id::Packet, ReadingError};
|
||||
use bytebuf::{packet::Packet, ReadingError};
|
||||
use bytes::{Buf, BufMut, Bytes};
|
||||
use codec::{identifier::Identifier, var_int::VarInt};
|
||||
use pumpkin_util::text::{style::Style, TextComponent};
|
||||
|
||||
@@ -216,7 +216,7 @@ pub enum PacketEncodeError {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::client::status::CStatusResponse;
|
||||
use crate::{bytebuf::packet_id::Packet, codec::DecodeError};
|
||||
use crate::{bytebuf::packet::Packet, codec::DecodeError};
|
||||
use aes::Aes128;
|
||||
use cfb8::cipher::AsyncStreamCipher;
|
||||
use cfb8::Decryptor as Cfb8Decryptor;
|
||||
|
||||
Loaded 100 of 210 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user