From 92fe87e921e225c6ecd46841958eaefb258687f3 Mon Sep 17 00:00:00 2001 From: Alexander Medvedev Date: Mon, 8 Dec 2025 20:52:03 +0100 Subject: [PATCH] smaller structure gen preparations --- pumpkin-data/build/biome.rs | 3 +- pumpkin-data/build/block.rs | 302 +++++++----------- pumpkin-data/build/effect.rs | 13 +- pumpkin-data/build/enchantments.rs | 1 - pumpkin-data/build/fluid.rs | 8 +- pumpkin-data/build/item.rs | 20 +- pumpkin-data/build/loot.rs | 2 +- pumpkin-data/build/message_type.rs | 31 +- pumpkin-data/build/noise_router.rs | 86 +++-- pumpkin-data/build/potion.rs | 7 +- pumpkin-data/build/potion_brewing.rs | 6 +- pumpkin-data/build/recipes.rs | 18 +- pumpkin-data/build/tag.rs | 8 +- pumpkin-data/src/data_component_impl.rs | 30 +- .../src/crafting/crafting_inventory.rs | 2 +- .../src/crafting/crafting_screen_handler.rs | 1 - pumpkin-inventory/src/double.rs | 1 - pumpkin-inventory/src/entity_equipment.rs | 2 +- pumpkin-inventory/src/furnace/furnace_slot.rs | 1 - .../src/player/ender_chest_inventory.rs | 1 - .../src/player/player_inventory.rs | 1 - pumpkin-inventory/src/slot.rs | 6 +- pumpkin-inventory/src/sync_handler.rs | 2 +- pumpkin-nbt/src/deserializer.rs | 2 - pumpkin-nbt/src/serializer.rs | 1 - .../src/codec/item_stack_seralizer.rs | 1 - .../src/java/server/play/set_creative_slot.rs | 2 +- pumpkin-util/src/math/block_box.rs | 31 ++ pumpkin-util/src/math/mod.rs | 1 + pumpkin-world/src/block/entities/barrel.rs | 1 - pumpkin-world/src/block/entities/chest.rs | 1 - .../src/block/entities/chiseled_bookshelf.rs | 1 - pumpkin-world/src/block/entities/dropper.rs | 1 - .../src/block/entities/ender_chest.rs | 1 - pumpkin-world/src/block/entities/furnace.rs | 1 - pumpkin-world/src/block/entities/hopper.rs | 1 - .../src/block/entities/shulker_box.rs | 1 - pumpkin-world/src/block/mod.rs | 2 +- pumpkin-world/src/chunk/format/anvil.rs | 4 - pumpkin-world/src/chunk/format/linear.rs | 2 +- pumpkin-world/src/chunk/format/mod.rs | 6 +- pumpkin-world/src/chunk/mod.rs | 6 +- pumpkin-world/src/chunk/palette.rs | 4 +- .../src/cylindrical_chunk_iterator.rs | 2 +- .../tree/decorator/attached_to_logs.rs | 3 +- .../feature/features/tree/decorator/mod.rs | 18 +- .../tree/decorator/place_on_ground.rs | 4 +- .../features/tree/decorator/trunk_vine.rs | 2 +- .../generation/feature/features/tree/mod.rs | 2 +- .../noise/router/density_function/mod.rs | 5 +- pumpkin-world/src/generation/proto_chunk.rs | 11 + .../generation/structure/shiftable_piece.rs | 0 .../structure/structures/buried_treasure.rs | 12 +- .../generation/structure/structures/mod.rs | 7 +- .../structure/structures/nether_fortress.rs | 6 +- .../structure/structures/swamp_hut.rs | 17 + pumpkin-world/src/inventory/inventory.rs | 3 +- pumpkin-world/src/item/mod.rs | 2 +- pumpkin-world/src/tick/mod.rs | 4 +- pumpkin-world/src/tick/scheduler.rs | 2 +- pumpkin/src/block/blocks/fire/fire.rs | 4 +- pumpkin/src/block/blocks/fire/mod.rs | 2 +- pumpkin/src/block/blocks/fire/soul_fire.rs | 2 +- pumpkin/src/block/blocks/piston/mod.rs | 7 +- pumpkin/src/command/args/message.rs | 2 +- pumpkin/src/command/client_suggestions.rs | 1 - pumpkin/src/command/dispatcher.rs | 4 +- .../src/entity/ai/goal/ambient_stand_goal.rs | 1 - pumpkin/src/entity/ai/goal/mod.rs | 2 +- pumpkin/src/entity/player.rs | 2 +- pumpkin/src/plugin/api/context.rs | 24 +- pumpkin/src/plugin/loader/native.rs | 1 - pumpkin/src/server/mod.rs | 2 +- pumpkin/src/server/tick_rate_manager.rs | 1 - pumpkin/src/world/custom_bossbar.rs | 5 +- pumpkin/src/world/mod.rs | 4 +- pumpkin/src/world/scoreboard.rs | 7 - 77 files changed, 376 insertions(+), 417 deletions(-) create mode 100644 pumpkin-util/src/math/block_box.rs create mode 100644 pumpkin-world/src/generation/structure/shiftable_piece.rs create mode 100644 pumpkin-world/src/generation/structure/structures/swamp_hut.rs diff --git a/pumpkin-data/build/biome.rs b/pumpkin-data/build/biome.rs index c5cfd2a2c..cd76a9c25 100644 --- a/pumpkin-data/build/biome.rs +++ b/pumpkin-data/build/biome.rs @@ -172,7 +172,7 @@ pub(crate) fn build() -> TokenStream { let mut name_to_type = TokenStream::new(); let mut id_to_type = TokenStream::new(); - for (name, biome) in biomes.iter() { + for (name, biome) in biomes.into_iter() { // let full_name = format!("minecraft:{name}"); let format_name = format_ident!("{}", name.to_shouty_snake_case()); let has_precipitation = biome.has_precipitation; @@ -184,7 +184,6 @@ pub(crate) fn build() -> TokenStream { let temperature_modifier = biome .temperature_modifier - .clone() .unwrap_or(TemperatureModifier::None); let monster: Vec<_> = biome diff --git a/pumpkin-data/build/block.rs b/pumpkin-data/build/block.rs index 7a001ec06..40edfbb45 100644 --- a/pumpkin-data/build/block.rs +++ b/pumpkin-data/build/block.rs @@ -331,7 +331,7 @@ impl ToTokens for BlockPropertyStruct { } } -#[derive(Deserialize, Clone, Debug)] +#[derive(Deserialize)] pub struct FlammableStruct { pub spread_chance: u8, pub burn_chance: u8, @@ -351,7 +351,7 @@ impl ToTokens for FlammableStruct { } } -#[derive(Deserialize, Clone, Copy, Debug)] +#[derive(Deserialize, Clone, Copy)] pub struct CollisionShape { pub min: Vector3, pub max: Vector3, @@ -376,7 +376,7 @@ impl ToTokens for CollisionShape { } } -#[derive(Deserialize, Clone, Debug)] +#[derive(Deserialize, Clone)] pub struct BlockState { pub id: u16, pub state_flags: u16, @@ -473,7 +473,7 @@ impl BlockState { } } -#[derive(Deserialize, Clone, Debug)] +#[derive(Deserialize)] pub struct Block { pub id: u16, pub name: String, @@ -492,7 +492,7 @@ pub struct Block { pub experience: Option, } -impl Block { +impl ToTokens for Block { fn to_tokens(&self, tokens: &mut TokenStream) { let id = LitInt::new(&self.id.to_string(), Span::call_site()); let name = LitStr::new(&self.name, Span::call_site()); @@ -567,7 +567,7 @@ pub enum GeneratedPropertyType { Enum { values: Vec }, } -#[derive(Deserialize, Clone, Debug)] +#[derive(Deserialize, Clone)] pub struct GeneratedProperty { hash_key: i32, enum_name: String, @@ -607,14 +607,14 @@ impl GeneratedProperty { } } -#[derive(Clone, Debug)] +#[derive(Clone)] struct Property { enum_name: String, serialized_name: String, values: Vec, } -#[derive(Deserialize, Clone, Debug)] +#[derive(Deserialize)] pub struct BlockAssets { pub blocks: Vec, pub shapes: Vec, @@ -626,9 +626,9 @@ pub(crate) fn build() -> TokenStream { println!("cargo:rerun-if-changed=../assets/bedrock_block_states.nbt"); println!("cargo:rerun-if-changed=../assets/properties.json"); - let be_blocks = fs::read("../assets/bedrock_block_states.nbt").unwrap(); - let mut be_blocks = Cursor::new(be_blocks); - let be_blocks = get_be_data_from_nbt(&mut be_blocks); + let be_blocks_data = fs::read("../assets/bedrock_block_states.nbt").unwrap(); + let mut be_blocks_cursor = Cursor::new(be_blocks_data); + let be_blocks = get_be_data_from_nbt(&mut be_blocks_cursor); let blocks_assets: BlockAssets = serde_json::from_str(&fs::read_to_string("../assets/blocks.json").unwrap()) @@ -638,30 +638,28 @@ pub(crate) fn build() -> TokenStream { serde_json::from_str(&fs::read_to_string("../assets/properties.json").unwrap()) .expect("Failed to parse properties.json"); - let mut type_from_raw_id_items = TokenStream::new(); - let mut block_from_name = TokenStream::new(); - let mut raw_id_from_state_id = TokenStream::new(); - let mut block_from_item_id = TokenStream::new(); - let mut state_from_state_id = TokenStream::new(); + let generated_prop_map: std::collections::HashMap = + generated_properties + .iter() + .map(|p| (p.hash_key, p)) + .collect(); + let mut random_tick_states = Vec::new(); - let mut block_properties_from_state_and_block_id = TokenStream::new(); - let mut block_properties_from_props_and_name = TokenStream::new(); - let mut existing_item_ids: Vec = Vec::new(); - let mut constants = TokenStream::new(); + let mut constants_list = Vec::new(); + let mut block_from_name_entries = Vec::new(); + let mut block_from_item_id_arms = Vec::new(); let mut block_state_to_bedrock = Vec::new(); - // Used to create property `enum`s. - let mut property_enums: BTreeMap = BTreeMap::new(); - // Property implementation for a block. - let mut block_properties: Vec = Vec::new(); - // Mapping of a collection of property hashes -> blocks that have these properties. - let mut property_collection_map: BTreeMap, PropertyCollectionData> = BTreeMap::new(); - // Validator that we have no `enum` collisions. - let mut optimized_blocks: Vec = Vec::new(); - for block in blocks_assets.blocks.clone() { - optimized_blocks.push(block.clone()); + let mut raw_id_from_state_id_array = Vec::new(); + let mut type_from_raw_id_array = Vec::new(); + let mut state_from_state_id_array = Vec::<(Ident, usize, u16)>::new(); - // Collect state IDs that have random ticks. + let mut property_enums: BTreeMap = BTreeMap::new(); + let mut block_properties: Vec = Vec::new(); + let mut property_collection_map: BTreeMap, PropertyCollectionData> = BTreeMap::new(); + let mut existing_item_ids: std::collections::HashSet = std::collections::HashSet::new(); + + for block in blocks_assets.blocks { for state in &block.states { if state.has_random_ticks() { let state_id = LitInt::new(&state.id.to_string(), Span::call_site()); @@ -671,16 +669,20 @@ pub(crate) fn build() -> TokenStream { let mut property_collection = HashSet::new(); let mut property_mapping = Vec::new(); - for property in block.properties { - let generated_property = generated_properties - .iter() - .find(|p| p.hash_key == property) - .unwrap(); + + for property_hash in &block.properties { + let generated_property = generated_prop_map + .get(property_hash) + .expect("Property hash not found in generated_properties"); + property_collection.insert(generated_property.hash_key); + let property = generated_property.to_property(); let renamed_property = property.enum_name.to_upper_camel_case(); - let property_type = if property.values == vec!["true".to_string(), "false".to_string()] + let property_type = if property.values.len() == 2 + && property.values.contains(&"true".to_string()) + && property.values.contains(&"false".to_string()) { PropertyType::Bool } else { @@ -690,7 +692,7 @@ pub(crate) fn build() -> TokenStream { }; if let PropertyType::Enum { name } = &property_type { - let _ = property_enums + property_enums .entry(name.clone()) .or_insert_with(|| PropertyStruct { name: name.clone(), @@ -699,97 +701,34 @@ pub(crate) fn build() -> TokenStream { } property_mapping.push(PropertyVariantMapping { - original_name: property.serialized_name.clone(), + original_name: property.serialized_name, property_type, }); } - // The Minecraft Java state manager deterministically produces an index given a set of properties. We must use - // the original property names here when checking for unique combinations of properties, and - // sort them to make a deterministic hash. - if !property_collection.is_empty() { - let mut property_collection = Vec::from_iter(property_collection); - property_collection.sort(); + let mut property_collection_vec: Vec = property_collection.into_iter().collect(); + property_collection_vec.sort_unstable(); + property_collection_map - .entry(property_collection) + .entry(property_collection_vec) .or_insert_with(|| PropertyCollectionData::from_mappings(property_mapping)) .add_block(block.name.clone(), block.id); } - } - for property_group in property_collection_map.into_values() { - for (block_name, id) in &property_group.blocks { - let const_block_name = Ident::new( - &const_block_name_from_block_name(block_name), - Span::call_site(), - ); - let property_name = Ident::new( - &property_group_name_from_derived_name(&property_group.derive_name()), - Span::call_site(), - ); - let id_lit = LitInt::new(&id.to_string(), Span::call_site()); - - block_properties_from_state_and_block_id.extend(quote! { - #id_lit => Box::new(#property_name::from_state_id(state_id, &Block::#const_block_name)), - }); - - block_properties_from_props_and_name.extend(quote! { - #id_lit => Box::new(#property_name::from_props(props, &Block::#const_block_name)), - }); - } - - block_properties.push(BlockPropertyStruct { - data: property_group, - }); - } - - // Generate the collision shapes array. - let shapes = blocks_assets - .shapes - .iter() - .map(|shape| shape.to_token_stream()); - - let random_tick_state_ids = quote! { - #(#random_tick_states)|* - }; - - //let unique_states_tokens = unique_states.iter().map(|state| state.to_tokens()); - - let block_props = block_properties.iter().map(|prop| prop.to_token_stream()); - let properties = property_enums.values().map(|prop| prop.to_token_stream()); - - // Generate the block entity types array. - let block_entity_types = blocks_assets - .block_entity_types - .iter() - .map(|entity_type| LitStr::new(entity_type, Span::call_site())); - - let mut raw_id_from_state_id_array = vec![]; - let mut type_from_raw_id_array = vec![]; - let mut state_from_state_id_array = Vec::<(Ident, usize, u16)>::new(); // block index state_id - - //let mut file = fs::File::create("../debug/debug.txt").unwrap(); - - // Generate constants and `match` arms for each block. - for block in optimized_blocks { let const_ident = format_ident!("{}", const_block_name_from_block_name(&block.name)); - let name = &block.name; - let mut block_tokens = TokenStream::new(); - block.to_tokens(&mut block_tokens); + let name_str = &block.name; let id_lit = LitInt::new(&block.id.to_string(), Span::call_site()); - let item_id = block.item_id; - constants.extend(quote! { - pub const #const_ident: Block = #block_tokens; - + constants_list.push(quote! { + pub const #const_ident: Block = #block; }); type_from_raw_id_array.push((block.id, quote! { &Self::#const_ident })); - block_from_name.extend(quote! { - #name => Self::#const_ident, + block_from_name_entries.push(quote! { + #name_str => Self::#const_ident, }); let be_name = match block.name.as_str() { @@ -810,71 +749,93 @@ pub(crate) fn build() -> TokenStream { for (i, state) in block.states.iter().enumerate() { if state_count != 0 { - if state_count > i as u32 { - let start_id = id as u16 + i as u16; - block_state_to_bedrock.push((state.id, start_id)) + let bedrock_val = if state_count > i as u32 { + id as u16 + i as u16 } else { - block_state_to_bedrock.push((state.id, id as u16)) - } + id as u16 + }; + block_state_to_bedrock.push((state.id, bedrock_val)); } - //else { - //file.write_all(format!("{be_name}\n").as_bytes()).unwrap(); - //} + raw_id_from_state_id_array.push((state.id, id_lit.clone())); + state_from_state_id_array.push((const_ident.clone(), i, state.id)); } - for (index, state) in block.states.iter().enumerate() { - state_from_state_id_array.push((const_ident.clone(), index, state.id)); - } - - if !existing_item_ids.contains(&item_id) { - block_from_item_id.extend(quote! { + if existing_item_ids.insert(item_id) { + block_from_item_id_arms.push(quote! { #item_id => Some(&Self::#const_ident), }); - existing_item_ids.push(item_id); } } + let mut block_properties_from_state_and_block_id_arms = Vec::new(); + let mut block_properties_from_props_and_name_arms = Vec::new(); + + for property_group in property_collection_map.into_values() { + let property_name = Ident::new( + &property_group_name_from_derived_name(&property_group.derive_name()), + Span::call_site(), + ); + + for (block_name, id) in &property_group.blocks { + let const_block_name = Ident::new( + &const_block_name_from_block_name(block_name), + Span::call_site(), + ); + let id_lit = LitInt::new(&id.to_string(), Span::call_site()); + + block_properties_from_state_and_block_id_arms.push(quote! { + #id_lit => Box::new(#property_name::from_state_id(state_id, &Block::#const_block_name)), + }); + + block_properties_from_props_and_name_arms.push(quote! { + #id_lit => Box::new(#property_name::from_props(props, &Block::#const_block_name)), + }); + } + + block_properties.push(BlockPropertyStruct { + data: property_group, + }); + } + + let shapes = blocks_assets + .shapes + .iter() + .map(|shape| shape.to_token_stream()); + + let random_tick_state_ids = quote! { #(#random_tick_states)|* }; + + let block_props = block_properties.iter().map(|prop| prop.to_token_stream()); + let properties = property_enums.values().map(|prop| prop.to_token_stream()); + + let block_entity_types = blocks_assets + .block_entity_types + .iter() + .map(|entity_type| LitStr::new(entity_type, Span::call_site())); + let raw_id_from_state_id_ordered = fill_array(raw_id_from_state_id_array); let max_state_id = raw_id_from_state_id_ordered.len(); - for id_lit in raw_id_from_state_id_ordered { - raw_id_from_state_id.extend(quote! { - #id_lit, - }); - } + let raw_id_from_state_id = quote! { #(#raw_id_from_state_id_ordered),* }; let max_index = block_state_to_bedrock .iter() - .map(|(index, _)| index) + .map(|(idx, _)| *idx) .max() - .unwrap(); - let mut state_to_bedrock_id = vec![quote! { 1 }; (max_index + 1) as usize]; - let mut block_state_to_bedrock_t = TokenStream::new(); - + .unwrap_or(0); + let mut state_to_bedrock_tokens = vec![quote! { 1 }; (max_index + 1) as usize]; for (state_id, id_lit) in block_state_to_bedrock { - state_to_bedrock_id[state_id as usize] = quote! { #id_lit }; + let lit = LitInt::new(&id_lit.to_string(), Span::call_site()); + state_to_bedrock_tokens[state_id as usize] = quote! { #lit }; } + let block_state_to_bedrock_t = quote! { #(#state_to_bedrock_tokens),* }; - for id_lit in state_to_bedrock_id { - block_state_to_bedrock_t.extend(quote! { - #id_lit, - }); - } + let type_from_raw_id_vec = fill_array(type_from_raw_id_array); + let max_type_id = type_from_raw_id_vec.len(); + let type_from_raw_id_items = quote! { #(#type_from_raw_id_vec),* }; - let type_from_raw_id_array = fill_array(type_from_raw_id_array); - let max_type_id = type_from_raw_id_array.len(); - for type_lit in type_from_raw_id_array { - type_from_raw_id_items.extend(quote! { - #type_lit, - }); - } - let state_from_state_id_array = fill_state_array(state_from_state_id_array); - let max_state_id_2 = state_from_state_id_array.len(); - for token in state_from_state_id_array { - state_from_state_id.extend(quote! { - #token, - }); - } + let state_from_state_id_vec = fill_state_array(state_from_state_id_array); + let max_state_id_2 = state_from_state_id_vec.len(); + let state_from_state_id = quote! { #(#state_from_state_id_vec),* }; assert_eq!(max_state_id, max_state_id_2); @@ -888,7 +849,6 @@ pub(crate) fn build() -> TokenStream { use std::collections::BTreeMap; use phf; - #[derive(Clone, Copy, Debug)] pub struct BlockProperty { pub name: &'static str, @@ -896,25 +856,13 @@ pub(crate) fn build() -> TokenStream { } pub trait BlockProperties where Self: 'static { - // Convert properties to an index (`0` to `N-1`). fn to_index(&self) -> u16; - // Convert an index back to properties. fn from_index(index: u16) -> Self where Self: Sized; - - // Check if a block uses this property fn handles_block_id(block_id: u16) -> bool where Self: Sized; - - // Convert properties to a state id. fn to_state_id(&self, block: &Block) -> u16; - // Convert a state id back to properties. fn from_state_id(state_id: u16, block: &Block) -> Self where Self: Sized; - // Get the default properties. fn default(block: &Block) -> Self where Self: Sized; - - // Convert properties to a `Vec` of `(name, value)` fn to_props(&self) -> Vec<(&'static str, &'static str)>; - - // Convert properties to a block state, and add them onto the default state. fn from_props(props: &[(&str, &str)], block: &Block) -> Self where Self: Sized; } @@ -930,10 +878,6 @@ pub(crate) fn build() -> TokenStream { #(#shapes),* ]; - //pub const BLOCK_STATES: &[BlockState] = &[ - // #(#unique_states_tokens),* - //]; - pub const BLOCK_ENTITY_TYPES: &[&str] = &[ #(#block_entity_types),* ]; @@ -976,14 +920,12 @@ pub(crate) fn build() -> TokenStream { } impl Block { - #constants + #(#constants_list)* - // String name to block struct const BLOCK_FROM_NAME_MAP: phf::Map<&'static str, Block> = phf::phf_map!{ - #block_from_name + #(#block_from_name_entries)* }; - // Many state ids map to single raw block id const RAW_ID_FROM_STATE_ID: [u16; #max_state_id] = [ #raw_id_from_state_id ]; @@ -1041,7 +983,7 @@ pub(crate) fn build() -> TokenStream { pub const fn from_item_id(id: u16) -> Option<&'static Self> { #[allow(unreachable_patterns)] match id { - #block_from_item_id + #(#block_from_item_id_arms)* _ => None } } @@ -1050,7 +992,7 @@ pub(crate) fn build() -> TokenStream { #[doc = r" Get the properties of the block."] pub fn properties(&self, state_id: u16) -> Option> { Some(match self.id { - #block_properties_from_state_and_block_id + #(#block_properties_from_state_and_block_id_arms)* _ => return None, }) } @@ -1059,7 +1001,7 @@ pub(crate) fn build() -> TokenStream { #[doc = r" Get the properties of the block."] pub fn from_properties(&self, props: &[(&str, &str)]) -> Box { match self.id { - #block_properties_from_props_and_name + #(#block_properties_from_props_and_name_arms)* _ => panic!("Invalid props") } } diff --git a/pumpkin-data/build/effect.rs b/pumpkin-data/build/effect.rs index d54194ad0..9f1c7e5ce 100644 --- a/pumpkin-data/build/effect.rs +++ b/pumpkin-data/build/effect.rs @@ -5,7 +5,7 @@ use proc_macro2::TokenStream; use quote::{format_ident, quote}; use serde::Deserialize; -#[derive(Deserialize, Clone)] +#[derive(Deserialize)] struct Effect { id: u8, category: MobEffectCategory, @@ -15,14 +15,14 @@ struct Effect { } #[allow(clippy::upper_case_acronyms)] -#[derive(Deserialize, Clone)] +#[derive(Deserialize)] pub enum MobEffectCategory { BENEFICIAL, HARMFUL, NEUTRAL, } -#[derive(Deserialize, Clone)] +#[derive(Deserialize)] pub struct Modifiers { attribute: String, id: String, @@ -32,9 +32,9 @@ pub struct Modifiers { } impl Modifiers { - pub fn to_tokens(&self) -> TokenStream { + pub fn get_tokens(self) -> TokenStream { let attribute = format_ident!("{}", self.attribute.to_uppercase()); - let id = self.id.clone(); + let id = self.id; let base_value = self.base_value; let operation = format_ident!("{}", self.operation.to_pascal_case()); quote! { @@ -76,7 +76,7 @@ pub(crate) fn build() -> TokenStream { let translation_key = effect.translation_key; let category = effect.category.to_tokens(); let slots = effect.attribute_modifiers; - let slots = slots.iter().map(|slot| slot.to_tokens()); + let slots = slots.into_iter().map(|slot| slot.get_tokens()); let minecraft_name = "minecraft:".to_string() + &name; variants.extend([quote! { @@ -100,7 +100,6 @@ pub(crate) fn build() -> TokenStream { use crate::attributes::Attributes; use crate::data_component_impl::Operation; - #[derive(Debug)] pub struct StatusEffect { pub minecraft_name: &'static str, pub id: u8, diff --git a/pumpkin-data/build/enchantments.rs b/pumpkin-data/build/enchantments.rs index d75fe0aa6..1ee26d9de 100644 --- a/pumpkin-data/build/enchantments.rs +++ b/pumpkin-data/build/enchantments.rs @@ -140,7 +140,6 @@ pub(crate) fn build() -> TokenStream { use std::hash::{Hash, Hasher}; use std::slice::Iter; - #[derive(Debug)] pub struct Enchantment { pub id: u8, pub name: &'static str, diff --git a/pumpkin-data/build/fluid.rs b/pumpkin-data/build/fluid.rs index a02d10399..234568651 100644 --- a/pumpkin-data/build/fluid.rs +++ b/pumpkin-data/build/fluid.rs @@ -599,7 +599,7 @@ pub(crate) fn build() -> TokenStream { use crate::tag::{Taggable, RegistryKey}; use pumpkin_util::resource_location::{FromResourceLocation, ResourceLocation, ToResourceLocation}; - #[derive(Clone, Debug)] + #[derive(Clone)] pub struct PartialFluidState { pub height: f32, pub level: i16, @@ -611,7 +611,7 @@ pub(crate) fn build() -> TokenStream { pub falling: bool, } - #[derive(Clone, Debug)] + #[derive(Clone)] pub struct FluidState { pub height: f32, pub level: i16, @@ -623,13 +623,13 @@ pub(crate) fn build() -> TokenStream { pub falling: bool, } - #[derive(Clone, Debug)] + #[derive(Clone)] pub struct FluidStateRef { pub id: u16, pub state_idx: u16, } - #[derive(Clone, Debug)] + #[derive(Clone)] pub struct Fluid { pub id: u16, pub name: &'static str, diff --git a/pumpkin-data/build/item.rs b/pumpkin-data/build/item.rs index 9d870497b..36c9cc34e 100644 --- a/pumpkin-data/build/item.rs +++ b/pumpkin-data/build/item.rs @@ -9,13 +9,13 @@ use serde::Deserialize; use std::{collections::BTreeMap, fs}; use syn::{Ident, LitBool, LitFloat, LitInt, LitStr}; -#[derive(Deserialize, Clone)] +#[derive(Deserialize)] pub struct Item { pub id: u16, pub components: ItemComponents, } -#[derive(Deserialize, Clone)] +#[derive(Deserialize)] pub struct ItemComponents { #[serde(rename = "minecraft:item_name")] pub item_name: TextComponent, @@ -354,7 +354,7 @@ fn return_1f32() -> f32 { fn return_true() -> bool { true } -#[derive(Deserialize, Clone, Debug)] +#[derive(Deserialize)] pub struct ToolComponent { rules: Vec, #[serde(default = "return_1f32")] @@ -369,7 +369,7 @@ fn return_false() -> bool { false } -#[derive(Deserialize, Copy, Clone, Debug)] +#[derive(Deserialize, Copy, Clone)] pub struct FoodComponent { nutrition: u8, saturation: f32, @@ -377,7 +377,7 @@ pub struct FoodComponent { can_always_eat: bool, } -#[derive(Deserialize, Clone, Debug)] +#[derive(Deserialize, Clone)] pub struct ToolRule { blocks: RegistryEntryList, speed: Option, @@ -398,23 +398,23 @@ fn _true() -> bool { true } -#[derive(Deserialize, Clone, Debug)] +#[derive(Deserialize, Clone)] pub struct Consumable { consume_seconds: Option, // TODO } -#[derive(Deserialize, Clone, Debug)] +#[derive(Deserialize, Clone)] pub struct DeathProtection { // TODO } -#[derive(Deserialize, Clone, Debug)] +#[derive(Deserialize, Clone)] pub struct BlocksAttacks { // TODO } #[allow(dead_code)] -#[derive(Deserialize, Clone, Debug)] +#[derive(Deserialize, Clone)] pub struct EquippableComponent { pub slot: String, pub equip_sound: Option, @@ -493,7 +493,7 @@ pub(crate) fn build() -> TokenStream { use crate::data_component::DataComponent; use crate::Block; - #[derive(Clone, Debug)] + #[derive(Clone)] pub struct Item { pub id: u16, pub registry_key: &'static str, diff --git a/pumpkin-data/build/loot.rs b/pumpkin-data/build/loot.rs index 1be9bb21f..9ed0b2888 100644 --- a/pumpkin-data/build/loot.rs +++ b/pumpkin-data/build/loot.rs @@ -7,7 +7,7 @@ use serde::Deserialize; use syn::LitStr; /// These are required to be defined twice because serde can't deserialize into static context for obvious reasons. -#[derive(Deserialize, Clone, Debug)] +#[derive(Deserialize)] pub struct LootTableStruct { r#type: LootTableTypeStruct, random_sequence: Option, diff --git a/pumpkin-data/build/message_type.rs b/pumpkin-data/build/message_type.rs index 31e0e7daa..526ec34c4 100644 --- a/pumpkin-data/build/message_type.rs +++ b/pumpkin-data/build/message_type.rs @@ -1,29 +1,28 @@ use std::{collections::BTreeMap, fs}; use proc_macro2::TokenStream; -use pumpkin_util::text::style::Style; use quote::{format_ident, quote}; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Deserialize)] pub struct RawChatType { id: u32, - components: ChatType, + // components: ChatType, } -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct ChatType { - chat: Decoration, - narration: Decoration, -} +// #[derive(Deserialize)] +// pub struct ChatType { +// chat: Decoration, +// narration: Decoration, +// } -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct Decoration { - translation_key: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - style: Option