From 4e3268b140c3a41eaf89e351b1e19bfa39885e13 Mon Sep 17 00:00:00 2001 From: Alexander Medvedev Date: Thu, 7 May 2026 22:02:52 +0200 Subject: [PATCH] feat: add stonecutter --- pumpkin-codegen/src/recipes.rs | 50 +- pumpkin-data/src/generated/recipes.rs | 2208 +++++++++++++++++ pumpkin-inventory/src/lib.rs | 1 + .../src/stonecutter_screen_handler.rs | 259 ++ pumpkin/src/block/blocks/mod.rs | 1 + pumpkin/src/block/blocks/stonecutter.rs | 56 + pumpkin/src/block/registry.rs | 2 + 7 files changed, 2573 insertions(+), 4 deletions(-) create mode 100644 pumpkin-inventory/src/stonecutter_screen_handler.rs create mode 100644 pumpkin/src/block/blocks/stonecutter.rs diff --git a/pumpkin-codegen/src/recipes.rs b/pumpkin-codegen/src/recipes.rs index 13a5319c8..dd3bbf1cb 100644 --- a/pumpkin-codegen/src/recipes.rs +++ b/pumpkin-codegen/src/recipes.rs @@ -38,15 +38,46 @@ pub enum RecipeTypes { /// Smoker cooking recipe. #[serde(rename = "minecraft:smoking")] Smoking(CookingRecipeStruct), - /// Stonecutter recipe (not yet codegen'd). + /// Stonecutter recipe. #[serde(rename = "minecraft:stonecutting")] - Stonecutting, + Stonecutting(StonecuttingRecipeStruct), /// Any special crafting recipe type (not yet codegen'd). #[serde(other)] #[serde(rename = "minecraft:crafting_special_*")] CraftingSpecial, } +/// Deserialized stonecutter recipe. +#[derive(Deserialize)] +pub struct StonecuttingRecipeStruct { + /// Optional recipe group used for advancement tracking. + group: Option, + /// The single ingredient required by this recipe. + ingredient: RecipeIngredientTypes, + /// The item produced by this recipe. + result: RecipeResultStruct, +} + +impl ToTokens for StonecuttingRecipeStruct { + fn to_tokens(&self, tokens: &mut TokenStream) { + let group = if let Some(group) = &self.group { + quote! { Some(#group) } + } else { + quote! { None } + }; + let ingredient = self.ingredient.to_token_stream(); + let result = self.result.to_token_stream(); + + tokens.extend(quote! { + StonecutterRecipe { + group: #group, + ingredient: #ingredient, + result: #result, + } + }); + } +} + /// Deserialized cooking recipe (furnace, blast furnace, smoker, or campfire). #[derive(Deserialize)] pub struct CookingRecipeStruct { @@ -432,6 +463,7 @@ pub fn build() -> TokenStream { let mut crafting_recipes = Vec::new(); let mut cooking_recipes = Vec::new(); + let mut stonecutting_recipes = Vec::new(); for recipe in recipes_assets { match recipe { @@ -493,7 +525,9 @@ pub fn build() -> TokenStream { }; cooking_recipes.push(smoking_token); } - RecipeTypes::Stonecutting => {} + RecipeTypes::Stonecutting(recipe) => { + stonecutting_recipes.push(recipe.to_token_stream()); + } RecipeTypes::CraftingSpecial => {} } } @@ -592,7 +626,12 @@ pub fn build() -> TokenStream { } } - + #[derive(Clone, Debug)] + pub struct StonecutterRecipe { + pub group: Option<&'static str>, + pub ingredient: RecipeIngredientTypes, + pub result: RecipeResultStruct, + } #[derive(Clone, Debug)] pub struct RecipeResultStruct { @@ -641,6 +680,9 @@ pub fn build() -> TokenStream { pub static RECIPES_COOKING: &[CookingRecipeType] = &[ #(#cooking_recipes ),* ]; + pub static RECIPES_STONECUTTING: &[StonecutterRecipe] = &[ + #(#stonecutting_recipes),* + ]; pub fn get_cooking_recipe_with_ingredient(ingredient: &Item, recipe_type: CookingRecipeKind) -> Option<&'static CookingRecipe> { RECIPES_COOKING diff --git a/pumpkin-data/src/generated/recipes.rs b/pumpkin-data/src/generated/recipes.rs index 218578a48..01d02ab54 100644 --- a/pumpkin-data/src/generated/recipes.rs +++ b/pumpkin-data/src/generated/recipes.rs @@ -86,6 +86,12 @@ impl CookingRecipeKind { } } #[derive(Clone, Debug)] +pub struct StonecutterRecipe { + pub group: Option<&'static str>, + pub ingredient: RecipeIngredientTypes, + pub result: RecipeResultStruct, +} +#[derive(Clone, Debug)] pub struct RecipeResultStruct { pub id: &'static str, pub count: u8, @@ -18269,6 +18275,2208 @@ pub static RECIPES_COOKING: &[CookingRecipeType] = &[ }, }), ]; +pub static RECIPES_STONECUTTING: &[StonecutterRecipe] = &[ + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:andesite"), + result: RecipeResultStruct { + id: "minecraft:andesite_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:andesite"), + result: RecipeResultStruct { + id: "minecraft:andesite_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:andesite"), + result: RecipeResultStruct { + id: "minecraft:andesite_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:blackstone"), + result: RecipeResultStruct { + id: "minecraft:blackstone_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:blackstone"), + result: RecipeResultStruct { + id: "minecraft:blackstone_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:blackstone"), + result: RecipeResultStruct { + id: "minecraft:blackstone_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:bricks"), + result: RecipeResultStruct { + id: "minecraft:brick_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:bricks"), + result: RecipeResultStruct { + id: "minecraft:brick_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:bricks"), + result: RecipeResultStruct { + id: "minecraft:brick_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:copper_block"), + result: RecipeResultStruct { + id: "minecraft:chiseled_copper", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cut_copper"), + result: RecipeResultStruct { + id: "minecraft:chiseled_copper", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cobbled_deepslate"), + result: RecipeResultStruct { + id: "minecraft:chiseled_deepslate", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate"), + result: RecipeResultStruct { + id: "minecraft:chiseled_deepslate", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:nether_bricks"), + result: RecipeResultStruct { + id: "minecraft:chiseled_nether_bricks", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:blackstone"), + result: RecipeResultStruct { + id: "minecraft:chiseled_polished_blackstone", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_blackstone"), + result: RecipeResultStruct { + id: "minecraft:chiseled_polished_blackstone", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:quartz_block"), + result: RecipeResultStruct { + id: "minecraft:chiseled_quartz_block", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:red_sandstone"), + result: RecipeResultStruct { + id: "minecraft:chiseled_red_sandstone", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:resin_bricks"), + result: RecipeResultStruct { + id: "minecraft:chiseled_resin_bricks", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:sandstone"), + result: RecipeResultStruct { + id: "minecraft:chiseled_sandstone", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:stone_bricks"), + result: RecipeResultStruct { + id: "minecraft:chiseled_stone_bricks", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:stone"), + result: RecipeResultStruct { + id: "minecraft:chiseled_stone_bricks", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_tuff"), + result: RecipeResultStruct { + id: "minecraft:chiseled_tuff_bricks", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:tuff_bricks"), + result: RecipeResultStruct { + id: "minecraft:chiseled_tuff_bricks", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:tuff"), + result: RecipeResultStruct { + id: "minecraft:chiseled_tuff_bricks", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:tuff"), + result: RecipeResultStruct { + id: "minecraft:chiseled_tuff", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate"), + result: RecipeResultStruct { + id: "minecraft:cobbled_deepslate", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cobbled_deepslate"), + result: RecipeResultStruct { + id: "minecraft:cobbled_deepslate_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate"), + result: RecipeResultStruct { + id: "minecraft:cobbled_deepslate_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cobbled_deepslate"), + result: RecipeResultStruct { + id: "minecraft:cobbled_deepslate_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate"), + result: RecipeResultStruct { + id: "minecraft:cobbled_deepslate_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cobbled_deepslate"), + result: RecipeResultStruct { + id: "minecraft:cobbled_deepslate_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate"), + result: RecipeResultStruct { + id: "minecraft:cobbled_deepslate_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:stone"), + result: RecipeResultStruct { + id: "minecraft:cobblestone", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cobblestone"), + result: RecipeResultStruct { + id: "minecraft:cobblestone_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:stone"), + result: RecipeResultStruct { + id: "minecraft:cobblestone_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cobblestone"), + result: RecipeResultStruct { + id: "minecraft:cobblestone_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:stone"), + result: RecipeResultStruct { + id: "minecraft:cobblestone_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cobblestone"), + result: RecipeResultStruct { + id: "minecraft:cobblestone_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:stone"), + result: RecipeResultStruct { + id: "minecraft:cobblestone_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:copper_block"), + result: RecipeResultStruct { + id: "minecraft:copper_grate", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:copper_block"), + result: RecipeResultStruct { + id: "minecraft:cut_copper", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:copper_block"), + result: RecipeResultStruct { + id: "minecraft:cut_copper_slab", + count: 8u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cut_copper"), + result: RecipeResultStruct { + id: "minecraft:cut_copper_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:copper_block"), + result: RecipeResultStruct { + id: "minecraft:cut_copper_stairs", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cut_copper"), + result: RecipeResultStruct { + id: "minecraft:cut_copper_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:red_sandstone"), + result: RecipeResultStruct { + id: "minecraft:cut_red_sandstone", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cut_red_sandstone"), + result: RecipeResultStruct { + id: "minecraft:cut_red_sandstone_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:red_sandstone"), + result: RecipeResultStruct { + id: "minecraft:cut_red_sandstone_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:sandstone"), + result: RecipeResultStruct { + id: "minecraft:cut_sandstone", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cut_sandstone"), + result: RecipeResultStruct { + id: "minecraft:cut_sandstone_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:sandstone"), + result: RecipeResultStruct { + id: "minecraft:cut_sandstone_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:dark_prismarine"), + result: RecipeResultStruct { + id: "minecraft:dark_prismarine_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:dark_prismarine"), + result: RecipeResultStruct { + id: "minecraft:dark_prismarine_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cobbled_deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_brick_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate_bricks"), + result: RecipeResultStruct { + id: "minecraft:deepslate_brick_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_brick_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_brick_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cobbled_deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_brick_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate_bricks"), + result: RecipeResultStruct { + id: "minecraft:deepslate_brick_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_brick_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_brick_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cobbled_deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_brick_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate_bricks"), + result: RecipeResultStruct { + id: "minecraft:deepslate_brick_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_brick_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_brick_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cobbled_deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_bricks", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_bricks", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_bricks", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cobbled_deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_tile_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate_bricks"), + result: RecipeResultStruct { + id: "minecraft:deepslate_tile_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_tile_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate_tiles"), + result: RecipeResultStruct { + id: "minecraft:deepslate_tile_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_tile_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cobbled_deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_tile_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate_bricks"), + result: RecipeResultStruct { + id: "minecraft:deepslate_tile_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_tile_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate_tiles"), + result: RecipeResultStruct { + id: "minecraft:deepslate_tile_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_tile_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cobbled_deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_tile_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate_bricks"), + result: RecipeResultStruct { + id: "minecraft:deepslate_tile_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_tile_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate_tiles"), + result: RecipeResultStruct { + id: "minecraft:deepslate_tile_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_tile_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cobbled_deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_tiles", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate_bricks"), + result: RecipeResultStruct { + id: "minecraft:deepslate_tiles", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_tiles", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_deepslate"), + result: RecipeResultStruct { + id: "minecraft:deepslate_tiles", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:diorite"), + result: RecipeResultStruct { + id: "minecraft:diorite_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:diorite"), + result: RecipeResultStruct { + id: "minecraft:diorite_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:diorite"), + result: RecipeResultStruct { + id: "minecraft:diorite_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:end_stone_bricks"), + result: RecipeResultStruct { + id: "minecraft:end_stone_brick_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:end_stone"), + result: RecipeResultStruct { + id: "minecraft:end_stone_brick_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:end_stone_bricks"), + result: RecipeResultStruct { + id: "minecraft:end_stone_brick_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:end_stone"), + result: RecipeResultStruct { + id: "minecraft:end_stone_brick_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:end_stone_bricks"), + result: RecipeResultStruct { + id: "minecraft:end_stone_brick_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:end_stone"), + result: RecipeResultStruct { + id: "minecraft:end_stone_brick_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:end_stone"), + result: RecipeResultStruct { + id: "minecraft:end_stone_bricks", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:exposed_copper"), + result: RecipeResultStruct { + id: "minecraft:exposed_chiseled_copper", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:exposed_cut_copper"), + result: RecipeResultStruct { + id: "minecraft:exposed_chiseled_copper", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:exposed_copper"), + result: RecipeResultStruct { + id: "minecraft:exposed_copper_grate", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:exposed_copper"), + result: RecipeResultStruct { + id: "minecraft:exposed_cut_copper", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:exposed_copper"), + result: RecipeResultStruct { + id: "minecraft:exposed_cut_copper_slab", + count: 8u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:exposed_cut_copper"), + result: RecipeResultStruct { + id: "minecraft:exposed_cut_copper_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:exposed_copper"), + result: RecipeResultStruct { + id: "minecraft:exposed_cut_copper_stairs", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:exposed_cut_copper"), + result: RecipeResultStruct { + id: "minecraft:exposed_cut_copper_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:granite"), + result: RecipeResultStruct { + id: "minecraft:granite_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:granite"), + result: RecipeResultStruct { + id: "minecraft:granite_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:granite"), + result: RecipeResultStruct { + id: "minecraft:granite_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:mossy_cobblestone"), + result: RecipeResultStruct { + id: "minecraft:mossy_cobblestone_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:mossy_cobblestone"), + result: RecipeResultStruct { + id: "minecraft:mossy_cobblestone_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:mossy_cobblestone"), + result: RecipeResultStruct { + id: "minecraft:mossy_cobblestone_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:mossy_stone_bricks"), + result: RecipeResultStruct { + id: "minecraft:mossy_stone_brick_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:mossy_stone_bricks"), + result: RecipeResultStruct { + id: "minecraft:mossy_stone_brick_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:mossy_stone_bricks"), + result: RecipeResultStruct { + id: "minecraft:mossy_stone_brick_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:mud_bricks"), + result: RecipeResultStruct { + id: "minecraft:mud_brick_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:mud_bricks"), + result: RecipeResultStruct { + id: "minecraft:mud_brick_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:mud_bricks"), + result: RecipeResultStruct { + id: "minecraft:mud_brick_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:nether_bricks"), + result: RecipeResultStruct { + id: "minecraft:nether_brick_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:nether_bricks"), + result: RecipeResultStruct { + id: "minecraft:nether_brick_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:nether_bricks"), + result: RecipeResultStruct { + id: "minecraft:nether_brick_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:oxidized_copper"), + result: RecipeResultStruct { + id: "minecraft:oxidized_chiseled_copper", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:oxidized_cut_copper"), + result: RecipeResultStruct { + id: "minecraft:oxidized_chiseled_copper", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:oxidized_copper"), + result: RecipeResultStruct { + id: "minecraft:oxidized_copper_grate", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:oxidized_copper"), + result: RecipeResultStruct { + id: "minecraft:oxidized_cut_copper", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:oxidized_copper"), + result: RecipeResultStruct { + id: "minecraft:oxidized_cut_copper_slab", + count: 8u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:oxidized_cut_copper"), + result: RecipeResultStruct { + id: "minecraft:oxidized_cut_copper_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:oxidized_copper"), + result: RecipeResultStruct { + id: "minecraft:oxidized_cut_copper_stairs", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:oxidized_cut_copper"), + result: RecipeResultStruct { + id: "minecraft:oxidized_cut_copper_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:andesite"), + result: RecipeResultStruct { + id: "minecraft:polished_andesite", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:andesite"), + result: RecipeResultStruct { + id: "minecraft:polished_andesite_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_andesite"), + result: RecipeResultStruct { + id: "minecraft:polished_andesite_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:andesite"), + result: RecipeResultStruct { + id: "minecraft:polished_andesite_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_andesite"), + result: RecipeResultStruct { + id: "minecraft:polished_andesite_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:basalt"), + result: RecipeResultStruct { + id: "minecraft:polished_basalt", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:blackstone"), + result: RecipeResultStruct { + id: "minecraft:polished_blackstone_brick_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_blackstone_bricks"), + result: RecipeResultStruct { + id: "minecraft:polished_blackstone_brick_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_blackstone"), + result: RecipeResultStruct { + id: "minecraft:polished_blackstone_brick_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:blackstone"), + result: RecipeResultStruct { + id: "minecraft:polished_blackstone_brick_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_blackstone_bricks"), + result: RecipeResultStruct { + id: "minecraft:polished_blackstone_brick_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_blackstone"), + result: RecipeResultStruct { + id: "minecraft:polished_blackstone_brick_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:blackstone"), + result: RecipeResultStruct { + id: "minecraft:polished_blackstone_brick_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_blackstone_bricks"), + result: RecipeResultStruct { + id: "minecraft:polished_blackstone_brick_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_blackstone"), + result: RecipeResultStruct { + id: "minecraft:polished_blackstone_brick_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:blackstone"), + result: RecipeResultStruct { + id: "minecraft:polished_blackstone_bricks", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_blackstone"), + result: RecipeResultStruct { + id: "minecraft:polished_blackstone_bricks", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:blackstone"), + result: RecipeResultStruct { + id: "minecraft:polished_blackstone", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:blackstone"), + result: RecipeResultStruct { + id: "minecraft:polished_blackstone_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_blackstone"), + result: RecipeResultStruct { + id: "minecraft:polished_blackstone_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:blackstone"), + result: RecipeResultStruct { + id: "minecraft:polished_blackstone_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_blackstone"), + result: RecipeResultStruct { + id: "minecraft:polished_blackstone_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:blackstone"), + result: RecipeResultStruct { + id: "minecraft:polished_blackstone_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_blackstone"), + result: RecipeResultStruct { + id: "minecraft:polished_blackstone_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cobbled_deepslate"), + result: RecipeResultStruct { + id: "minecraft:polished_deepslate", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate"), + result: RecipeResultStruct { + id: "minecraft:polished_deepslate", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cobbled_deepslate"), + result: RecipeResultStruct { + id: "minecraft:polished_deepslate_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate"), + result: RecipeResultStruct { + id: "minecraft:polished_deepslate_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_deepslate"), + result: RecipeResultStruct { + id: "minecraft:polished_deepslate_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cobbled_deepslate"), + result: RecipeResultStruct { + id: "minecraft:polished_deepslate_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate"), + result: RecipeResultStruct { + id: "minecraft:polished_deepslate_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_deepslate"), + result: RecipeResultStruct { + id: "minecraft:polished_deepslate_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:cobbled_deepslate"), + result: RecipeResultStruct { + id: "minecraft:polished_deepslate_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:deepslate"), + result: RecipeResultStruct { + id: "minecraft:polished_deepslate_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_deepslate"), + result: RecipeResultStruct { + id: "minecraft:polished_deepslate_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:diorite"), + result: RecipeResultStruct { + id: "minecraft:polished_diorite", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:diorite"), + result: RecipeResultStruct { + id: "minecraft:polished_diorite_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_diorite"), + result: RecipeResultStruct { + id: "minecraft:polished_diorite_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:diorite"), + result: RecipeResultStruct { + id: "minecraft:polished_diorite_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_diorite"), + result: RecipeResultStruct { + id: "minecraft:polished_diorite_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:granite"), + result: RecipeResultStruct { + id: "minecraft:polished_granite", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:granite"), + result: RecipeResultStruct { + id: "minecraft:polished_granite_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_granite"), + result: RecipeResultStruct { + id: "minecraft:polished_granite_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:granite"), + result: RecipeResultStruct { + id: "minecraft:polished_granite_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_granite"), + result: RecipeResultStruct { + id: "minecraft:polished_granite_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:tuff"), + result: RecipeResultStruct { + id: "minecraft:polished_tuff", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_tuff"), + result: RecipeResultStruct { + id: "minecraft:polished_tuff_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:tuff"), + result: RecipeResultStruct { + id: "minecraft:polished_tuff_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_tuff"), + result: RecipeResultStruct { + id: "minecraft:polished_tuff_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:tuff"), + result: RecipeResultStruct { + id: "minecraft:polished_tuff_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_tuff"), + result: RecipeResultStruct { + id: "minecraft:polished_tuff_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:tuff"), + result: RecipeResultStruct { + id: "minecraft:polished_tuff_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:prismarine_bricks"), + result: RecipeResultStruct { + id: "minecraft:prismarine_brick_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:prismarine_bricks"), + result: RecipeResultStruct { + id: "minecraft:prismarine_brick_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:prismarine"), + result: RecipeResultStruct { + id: "minecraft:prismarine_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:prismarine"), + result: RecipeResultStruct { + id: "minecraft:prismarine_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:prismarine"), + result: RecipeResultStruct { + id: "minecraft:prismarine_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:purpur_block"), + result: RecipeResultStruct { + id: "minecraft:purpur_pillar", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:purpur_block"), + result: RecipeResultStruct { + id: "minecraft:purpur_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:purpur_block"), + result: RecipeResultStruct { + id: "minecraft:purpur_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:quartz_block"), + result: RecipeResultStruct { + id: "minecraft:quartz_bricks", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:quartz_block"), + result: RecipeResultStruct { + id: "minecraft:quartz_pillar", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:quartz_block"), + result: RecipeResultStruct { + id: "minecraft:quartz_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:quartz_block"), + result: RecipeResultStruct { + id: "minecraft:quartz_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:red_nether_bricks"), + result: RecipeResultStruct { + id: "minecraft:red_nether_brick_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:red_nether_bricks"), + result: RecipeResultStruct { + id: "minecraft:red_nether_brick_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:red_nether_bricks"), + result: RecipeResultStruct { + id: "minecraft:red_nether_brick_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:red_sandstone"), + result: RecipeResultStruct { + id: "minecraft:red_sandstone_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:red_sandstone"), + result: RecipeResultStruct { + id: "minecraft:red_sandstone_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:red_sandstone"), + result: RecipeResultStruct { + id: "minecraft:red_sandstone_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:resin_bricks"), + result: RecipeResultStruct { + id: "minecraft:resin_brick_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:resin_bricks"), + result: RecipeResultStruct { + id: "minecraft:resin_brick_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:resin_bricks"), + result: RecipeResultStruct { + id: "minecraft:resin_brick_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:sandstone"), + result: RecipeResultStruct { + id: "minecraft:sandstone_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:sandstone"), + result: RecipeResultStruct { + id: "minecraft:sandstone_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:sandstone"), + result: RecipeResultStruct { + id: "minecraft:sandstone_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:smooth_quartz"), + result: RecipeResultStruct { + id: "minecraft:smooth_quartz_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:smooth_quartz"), + result: RecipeResultStruct { + id: "minecraft:smooth_quartz_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:smooth_red_sandstone"), + result: RecipeResultStruct { + id: "minecraft:smooth_red_sandstone_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:smooth_red_sandstone"), + result: RecipeResultStruct { + id: "minecraft:smooth_red_sandstone_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:smooth_sandstone"), + result: RecipeResultStruct { + id: "minecraft:smooth_sandstone_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:smooth_sandstone"), + result: RecipeResultStruct { + id: "minecraft:smooth_sandstone_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:smooth_stone"), + result: RecipeResultStruct { + id: "minecraft:smooth_stone_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:stone_bricks"), + result: RecipeResultStruct { + id: "minecraft:stone_brick_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:stone"), + result: RecipeResultStruct { + id: "minecraft:stone_brick_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:stone_bricks"), + result: RecipeResultStruct { + id: "minecraft:stone_brick_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:stone"), + result: RecipeResultStruct { + id: "minecraft:stone_brick_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:stone_bricks"), + result: RecipeResultStruct { + id: "minecraft:stone_brick_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:stone"), + result: RecipeResultStruct { + id: "minecraft:stone_brick_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:stone"), + result: RecipeResultStruct { + id: "minecraft:stone_bricks", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:stone"), + result: RecipeResultStruct { + id: "minecraft:stone_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:stone"), + result: RecipeResultStruct { + id: "minecraft:stone_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_tuff"), + result: RecipeResultStruct { + id: "minecraft:tuff_brick_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:tuff_bricks"), + result: RecipeResultStruct { + id: "minecraft:tuff_brick_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:tuff"), + result: RecipeResultStruct { + id: "minecraft:tuff_brick_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_tuff"), + result: RecipeResultStruct { + id: "minecraft:tuff_brick_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:tuff_bricks"), + result: RecipeResultStruct { + id: "minecraft:tuff_brick_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:tuff"), + result: RecipeResultStruct { + id: "minecraft:tuff_brick_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_tuff"), + result: RecipeResultStruct { + id: "minecraft:tuff_brick_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:tuff_bricks"), + result: RecipeResultStruct { + id: "minecraft:tuff_brick_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:tuff"), + result: RecipeResultStruct { + id: "minecraft:tuff_brick_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:polished_tuff"), + result: RecipeResultStruct { + id: "minecraft:tuff_bricks", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:tuff"), + result: RecipeResultStruct { + id: "minecraft:tuff_bricks", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:tuff"), + result: RecipeResultStruct { + id: "minecraft:tuff_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:tuff"), + result: RecipeResultStruct { + id: "minecraft:tuff_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:tuff"), + result: RecipeResultStruct { + id: "minecraft:tuff_wall", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_copper_block"), + result: RecipeResultStruct { + id: "minecraft:waxed_chiseled_copper", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_cut_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_chiseled_copper", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_copper_block"), + result: RecipeResultStruct { + id: "minecraft:waxed_copper_grate", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_copper_block"), + result: RecipeResultStruct { + id: "minecraft:waxed_cut_copper", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_copper_block"), + result: RecipeResultStruct { + id: "minecraft:waxed_cut_copper_slab", + count: 8u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_cut_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_cut_copper_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_copper_block"), + result: RecipeResultStruct { + id: "minecraft:waxed_cut_copper_stairs", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_cut_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_cut_copper_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_exposed_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_exposed_chiseled_copper", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_exposed_cut_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_exposed_chiseled_copper", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_exposed_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_exposed_copper_grate", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_exposed_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_exposed_cut_copper", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_exposed_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_exposed_cut_copper_slab", + count: 8u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_exposed_cut_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_exposed_cut_copper_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_exposed_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_exposed_cut_copper_stairs", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_exposed_cut_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_exposed_cut_copper_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_oxidized_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_oxidized_chiseled_copper", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_oxidized_cut_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_oxidized_chiseled_copper", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_oxidized_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_oxidized_copper_grate", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_oxidized_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_oxidized_cut_copper", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_oxidized_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_oxidized_cut_copper_slab", + count: 8u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_oxidized_cut_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_oxidized_cut_copper_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_oxidized_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_oxidized_cut_copper_stairs", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_oxidized_cut_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_oxidized_cut_copper_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_weathered_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_weathered_chiseled_copper", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_weathered_cut_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_weathered_chiseled_copper", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_weathered_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_weathered_copper_grate", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_weathered_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_weathered_cut_copper", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_weathered_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_weathered_cut_copper_slab", + count: 8u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_weathered_cut_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_weathered_cut_copper_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_weathered_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_weathered_cut_copper_stairs", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:waxed_weathered_cut_copper"), + result: RecipeResultStruct { + id: "minecraft:waxed_weathered_cut_copper_stairs", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:weathered_copper"), + result: RecipeResultStruct { + id: "minecraft:weathered_chiseled_copper", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:weathered_cut_copper"), + result: RecipeResultStruct { + id: "minecraft:weathered_chiseled_copper", + count: 1u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:weathered_copper"), + result: RecipeResultStruct { + id: "minecraft:weathered_copper_grate", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:weathered_copper"), + result: RecipeResultStruct { + id: "minecraft:weathered_cut_copper", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:weathered_copper"), + result: RecipeResultStruct { + id: "minecraft:weathered_cut_copper_slab", + count: 8u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:weathered_cut_copper"), + result: RecipeResultStruct { + id: "minecraft:weathered_cut_copper_slab", + count: 2u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:weathered_copper"), + result: RecipeResultStruct { + id: "minecraft:weathered_cut_copper_stairs", + count: 4u8, + }, + }, + StonecutterRecipe { + group: None, + ingredient: RecipeIngredientTypes::Simple("minecraft:weathered_cut_copper"), + result: RecipeResultStruct { + id: "minecraft:weathered_cut_copper_stairs", + count: 1u8, + }, + }, +]; pub fn get_cooking_recipe_with_ingredient( ingredient: &Item, recipe_type: CookingRecipeKind, diff --git a/pumpkin-inventory/src/lib.rs b/pumpkin-inventory/src/lib.rs index 1b9e8c3bb..642997614 100644 --- a/pumpkin-inventory/src/lib.rs +++ b/pumpkin-inventory/src/lib.rs @@ -47,6 +47,7 @@ pub mod merchant; pub mod player; pub mod screen_handler; pub mod slot; +pub mod stonecutter_screen_handler; pub mod sync_handler; pub mod window_property; diff --git a/pumpkin-inventory/src/stonecutter_screen_handler.rs b/pumpkin-inventory/src/stonecutter_screen_handler.rs new file mode 100644 index 000000000..267297a94 --- /dev/null +++ b/pumpkin-inventory/src/stonecutter_screen_handler.rs @@ -0,0 +1,259 @@ +use std::any::Any; +use std::sync::Arc; +use std::sync::atomic::{AtomicU8, Ordering}; +use tokio::sync::Mutex; + +use crate::player::player_inventory::PlayerInventory; +use crate::screen_handler::{ + InventoryPlayer, ScreenHandler, ScreenHandlerBehaviour, ScreenHandlerFuture, +}; +use crate::slot::{BoxFuture, NormalSlot, Slot}; + +use pumpkin_data::item::Item; +use pumpkin_data::item_stack::ItemStack; +use pumpkin_data::recipes::{RECIPES_STONECUTTING, StonecutterRecipe}; +use pumpkin_data::screen::WindowType; +use pumpkin_protocol::java::server::play::SlotActionType; +use pumpkin_world::inventory::Inventory; +use pumpkin_world::inventory::SimpleInventory; + +pub struct StonecutterScreenHandler { + behaviour: ScreenHandlerBehaviour, + pub input_inventory: Arc, + pub output_inventory: Arc, + pub selected_recipe: AtomicU8, +} + +impl StonecutterScreenHandler { + pub fn new(sync_id: u8, player_inventory: &Arc) -> Self { + let behaviour = ScreenHandlerBehaviour::new(sync_id, Some(WindowType::Stonecutter)); + let input_inventory = Arc::new(SimpleInventory::new(1)); + let output_inventory = Arc::new(SimpleInventory::new(1)); + + let mut handler = Self { + behaviour, + input_inventory: input_inventory.clone(), + output_inventory: output_inventory.clone(), + selected_recipe: AtomicU8::new(u8::MAX), + }; + + handler.add_slot(Arc::new(NormalSlot::new( + input_inventory.clone() as Arc, + 0, + ))); + handler.add_slot(Arc::new(StonecutterOutputSlot::new( + output_inventory as Arc, + input_inventory as Arc, + 0, + ))); + + let player_inventory: Arc = player_inventory.clone(); + + handler.add_player_slots(&player_inventory); + + handler + } + + async fn update_output(&self) { + let input_stack = self.input_inventory.get_stack(0).await; + let input_lock = input_stack.lock().await; + + if input_lock.is_empty() { + self.output_inventory + .set_stack(0, ItemStack::EMPTY.clone()) + .await; + self.selected_recipe.store(u8::MAX, Ordering::Relaxed); + return; + } + + let available_recipes = Self::get_available_recipes(&input_lock); + let recipe_index = self.selected_recipe.load(Ordering::Relaxed); + + if recipe_index != u8::MAX && (recipe_index as usize) < available_recipes.len() { + let recipe = available_recipes[recipe_index as usize]; + let item = + Item::from_registry_key(recipe.result.id).expect("Invalid recipe result item"); + let result = ItemStack::new(recipe.result.count, item); + self.output_inventory.set_stack(0, result).await; + } else { + self.output_inventory + .set_stack(0, ItemStack::EMPTY.clone()) + .await; + } + } + + fn get_available_recipes(input: &ItemStack) -> Vec<&'static StonecutterRecipe> { + let item = input.item; + RECIPES_STONECUTTING + .iter() + .filter(|r| r.ingredient.match_item(item)) + .collect() + } +} + +impl ScreenHandler for StonecutterScreenHandler { + fn get_behaviour(&self) -> &ScreenHandlerBehaviour { + &self.behaviour + } + + fn get_behaviour_mut(&mut self) -> &mut ScreenHandlerBehaviour { + &mut self.behaviour + } + + fn as_any(&self) -> &dyn Any { + self + } + + fn as_any_mut(&mut self) -> &mut dyn Any { + self + } + + fn on_slot_click<'a>( + &'a mut self, + slot_index: i32, + button: i32, + action_type: SlotActionType, + player: &'a dyn InventoryPlayer, + ) -> ScreenHandlerFuture<'a, ()> { + Box::pin(async move { + self.internal_on_slot_click(slot_index, button, action_type, player) + .await; + if slot_index == 0 { + self.update_output().await; + } + }) + } + + fn quick_move<'a>( + &'a mut self, + _player: &'a dyn InventoryPlayer, + slot_index: i32, + ) -> ScreenHandlerFuture<'a, ItemStack> { + Box::pin(async move { + let mut stack = ItemStack::EMPTY.clone(); + let slot = self.get_behaviour().slots.get(slot_index as usize).cloned(); + + if let Some(slot) = slot { + let mut slot_stack = slot.get_cloned_stack().await; + if !slot_stack.is_empty() { + stack = slot_stack.clone(); + if slot_index < 2 { + // From Stonecutter to Player + if !self.insert_item(&mut slot_stack, 2, 38, true).await { + return ItemStack::EMPTY.clone(); + } + slot.on_quick_move_crafted(slot_stack.clone(), stack.clone()) + .await; + } else { + // From Player to Stonecutter + // Try input slot (0) + if !self.insert_item(&mut slot_stack, 0, 1, false).await { + return ItemStack::EMPTY.clone(); + } + } + + if slot_stack.is_empty() { + slot.set_stack(ItemStack::EMPTY.clone()).await; + } else { + slot.set_stack(slot_stack).await; + } + } + } + stack + }) + } +} + +pub struct StonecutterOutputSlot { + pub inventory: Arc, + pub input_inventory: Arc, + pub index: usize, + pub id: AtomicU8, +} + +impl StonecutterOutputSlot { + pub fn new( + inventory: Arc, + input_inventory: Arc, + index: usize, + ) -> Self { + Self { + inventory, + input_inventory, + index, + id: AtomicU8::new(0), + } + } +} + +impl Slot for StonecutterOutputSlot { + fn get_inventory(&self) -> Arc { + self.inventory.clone() + } + + fn get_index(&self) -> usize { + self.index + } + + fn set_id(&self, id: usize) { + self.id.store(id as u8, Ordering::Relaxed); + } + + fn on_take_item<'a>( + &'a self, + _player: &'a dyn InventoryPlayer, + _stack: &'a ItemStack, + ) -> BoxFuture<'a, ()> { + Box::pin(async move { + let input_stack = self.input_inventory.get_stack(0).await; + let mut input_lock = input_stack.lock().await; + if !input_lock.is_empty() { + input_lock.item_count -= 1; + if input_lock.item_count == 0 { + *input_lock = ItemStack::EMPTY.clone(); + } + } + self.mark_dirty().await; + }) + } + + fn can_insert(&self, _stack: &ItemStack) -> BoxFuture<'_, bool> { + Box::pin(async move { false }) + } + + fn get_stack(&self) -> BoxFuture<'_, Arc>> { + Box::pin(async move { self.inventory.get_stack(self.index).await }) + } + + fn get_cloned_stack(&self) -> BoxFuture<'_, ItemStack> { + Box::pin(async move { + let stack = self.inventory.get_stack(self.index).await; + stack.lock().await.clone() + }) + } + + fn has_stack(&self) -> BoxFuture<'_, bool> { + Box::pin(async move { + let stack = self.inventory.get_stack(self.index).await; + !stack.lock().await.is_empty() + }) + } + + fn set_stack(&self, stack: ItemStack) -> BoxFuture<'_, ()> { + Box::pin(async move { + self.inventory.set_stack(self.index, stack).await; + }) + } + + fn set_stack_prev(&self, _stack: ItemStack, _previous_stack: ItemStack) -> BoxFuture<'_, ()> { + Box::pin(async move { + // Do nothing + }) + } + + fn mark_dirty(&self) -> BoxFuture<'_, ()> { + Box::pin(async move { + self.inventory.mark_dirty(); + }) + } +} diff --git a/pumpkin/src/block/blocks/mod.rs b/pumpkin/src/block/blocks/mod.rs index 9977a0bc6..4364df709 100644 --- a/pumpkin/src/block/blocks/mod.rs +++ b/pumpkin/src/block/blocks/mod.rs @@ -19,6 +19,7 @@ pub mod enchanting_table; pub mod furnace; pub mod grindstone; pub mod smoker; +pub mod stonecutter; // Redstone & mechanisms pub mod command; // command block / redstone control diff --git a/pumpkin/src/block/blocks/stonecutter.rs b/pumpkin/src/block/blocks/stonecutter.rs new file mode 100644 index 000000000..ed943c92f --- /dev/null +++ b/pumpkin/src/block/blocks/stonecutter.rs @@ -0,0 +1,56 @@ +use crate::block::registry::BlockActionResult; +use crate::block::{BlockBehaviour, BlockFuture, NormalUseArgs}; + +use pumpkin_data::translation; +use pumpkin_inventory::player::player_inventory::PlayerInventory; +use pumpkin_inventory::screen_handler::{ + BoxFuture, InventoryPlayer, ScreenHandlerFactory, SharedScreenHandler, +}; +use pumpkin_macros::pumpkin_block; +use pumpkin_util::text::TextComponent; +use std::sync::Arc; +use tokio::sync::Mutex; + +use pumpkin_inventory::stonecutter_screen_handler::StonecutterScreenHandler; + +#[pumpkin_block("minecraft:stonecutter")] +pub struct StonecutterBlock; + +impl BlockBehaviour for StonecutterBlock { + fn normal_use<'a>(&'a self, args: NormalUseArgs<'a>) -> BlockFuture<'a, BlockActionResult> { + Box::pin(async move { + args.player + .open_handled_screen(&StonecutterScreenFactory, Some(*args.position)) + .await; + + BlockActionResult::Success + }) + } +} + +struct StonecutterScreenFactory; + +impl ScreenHandlerFactory for StonecutterScreenFactory { + fn create_screen_handler<'a>( + &'a self, + sync_id: u8, + player_inventory: &'a Arc, + _player: &'a dyn InventoryPlayer, + ) -> BoxFuture<'a, Option> { + Box::pin(async move { + let handler: SharedScreenHandler = Arc::new(Mutex::new(StonecutterScreenHandler::new( + sync_id, + player_inventory, + ))); + Some(handler) + }) + } + + fn get_display_name(&self) -> TextComponent { + TextComponent::translate_cross( + translation::java::CONTAINER_STONECUTTER, + translation::bedrock::CONTAINER_STONECUTTER, + &[], + ) + } +} diff --git a/pumpkin/src/block/registry.rs b/pumpkin/src/block/registry.rs index 49ea4e22e..e4c86b7ba 100644 --- a/pumpkin/src/block/registry.rs +++ b/pumpkin/src/block/registry.rs @@ -171,6 +171,7 @@ use crate::block::blocks::lectern::LecternBlock; use crate::block::blocks::shulker_box::ShulkerBoxBlock; use crate::block::blocks::skull_block::SkullBlock; use crate::block::blocks::smoker::SmokerBlock; +use crate::block::blocks::stonecutter::StonecutterBlock; #[must_use] #[expect(clippy::too_many_lines)] @@ -222,6 +223,7 @@ pub fn default_registry() -> Arc { manager.register(SlabBlock); manager.register(SlimeBlock); manager.register(StairBlock); + manager.register(StonecutterBlock); manager.register(ShortPlantBlock); manager.register(DryVegetationBlock); manager.register(LilyPadBlock);