From 36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9 Mon Sep 17 00:00:00 2001 From: Tobias Wilken Date: Tue, 14 Jul 2020 18:56:42 +0200 Subject: Introduce recipe book functionality (#4493) * Introduce recipe book functionality The recipe book helps especially new players. Missing it gives the impression that cuberite is not as advanced as it is. The handling of the recipe book uses the following functions: - Unlock Recipes (https://wiki.vg/index.php?title=Protocol&oldid=14204#Unlock_Recipes) to make recipes available and show the notification for new recipes. Initialization is done on player login for known ones, the update is done when new items are discovered. - Craft Recipe Request (https://wiki.vg/index.php?title=Protocol&oldid=14204#Craft_Recipe_Request) when the user selects a recipe from the recipe book to fill the slots. Known recipes are initialized on player login via `Unlock Recipes` with `Action` 0. As soon as a new recipe is discovered this is added via `Unlock Recipes` with `Action` 1. To be able to know and recognize new recipes the player class is extended with `KnownItems` and `KnownRecipes`. As soon as a player touches an item this is compared to the list of `KnownItems`, if the item is unknown the recipes are checked for this item and the other ingredients are checked with the list of `KnownItems`. If a full match is discovered the recipe is unlocked with the client and stored in the `KnownRecipes`. To unlock recipes the recipe ID is sent to the client. A mapping file (for protocol 1.12.2) translated the minecraft recipe names to ids. The crafting.txt is extended with and minecraft recipe names is possible. Limitations: Only a single recipe is added to the crafting area. Multiple clicks or shift click does not increase the number of builds. Co-authored-by: peterbell10 * Address first issues mentioned by @peterbell10 - Some linting - Extract loading of recipe specific protocol mapping into a function - Build `RecipeNameMap` only once - Use `std::optional` - Extract `LoadRecipe` from `Window` * Start to implement new suggestions * Update with suggestions from @peterbell10 * Some minor cleanup * Update protocol packet IDs * Remove unused include * Include header in cmake * Change a vector to integer counter * Change dromedaryCase method names to PascalCase * Address suggestions from @madmaxoft * Read Protocol subdirectories to load recipe books To load all recipebooks iterate over the `Protocol` subdirectories to find mapping files. Co-authored-by: peterbell10 --- Server/Protocol/1.12.2/base.recipes.txt | 434 ++++++++++++++++++++++++++++++++ 1 file changed, 434 insertions(+) create mode 100644 Server/Protocol/1.12.2/base.recipes.txt (limited to 'Server/Protocol/1.12.2/base.recipes.txt') diff --git a/Server/Protocol/1.12.2/base.recipes.txt b/Server/Protocol/1.12.2/base.recipes.txt new file mode 100644 index 000000000..e5c52fa8b --- /dev/null +++ b/Server/Protocol/1.12.2/base.recipes.txt @@ -0,0 +1,434 @@ +# recipeId minecraftName + +11 yellow_wool +12 yellow_terracotta +13 yellow_stained_glass_pane +14 yellow_stained_glass +15 yellow_dye_from_sunflower +16 yellow_dye_from_dandelion +17 yellow_concrete_powder +18 yellow_carpet +19 yellow_bed_from_white_bed +20 yellow_bed +21 yellow_banner +22 writable_book +23 wooden_sword +24 wooden_shovel +25 wooden_pressure_plate +26 wooden_pickaxe +27 wooden_hoe +28 oak_door +29 oak_button +30 wooden_axe +31 white_terracotta +32 white_stained_glass_pane +33 white_stained_glass +34 white_concrete_powder +35 white_carpet +36 white_bed +37 white_banner +38 wheat +39 tripwire_hook +40 trapped_chest +41 oak_trapdoor +42 torch +43 tnt_minecart +44 tnt +45 sugar +46 white_wool_from_string +47 stone_bricks +48 stone_sword +49 stone_stairs +50 stone_slab +51 stone_shovel +52 stone_pressure_plate +53 stone_pickaxe +54 stone_hoe +55 stone_button +56 stone_brick_stairs +57 stone_brick_slab +58 stone_axe +59 sticky_piston +60 stick +61 spruce_stairs +62 spruce_slab +63 spruce_planks +64 spruce_fence_gate +65 spruce_fence +66 spruce_door +67 spruce_boat +68 spectral_arrow +69 glistering_melon_slice +70 snow +71 snow_block +72 smooth_sandstone +73 smooth_red_sandstone +74 slime_ball +75 slime_block +76 oak_sign +77 shield +78 shears +79 sea_lantern +80 sandstone_stairs +81 sandstone_slab +82 sandstone +83 repeater +84 redstone_torch +85 redstone_lamp +86 redstone_block +87 redstone +88 red_wool +89 red_terracotta +90 red_stained_glass_pane +91 red_stained_glass +92 red_sandstone_stairs +93 red_sandstone_slab +94 red_sandstone +95 red_nether_bricks +96 red_dye_from_tulip +97 red_dye_from_rose_bush +98 red_dye_from_poppy +99 red_dye_from_beetroot +100 red_concrete_powder +101 red_carpet +102 red_bed_from_white_bed +103 red_bed +104 red_banner +105 rail +106 rabbit_stew_from_red_mushroom +107 rabbit_stew_from_brown_mushroom +108 quartz_stairs +109 quartz_slab +110 quartz_block +111 purpur_stairs +112 purpur_slab +113 purpur_pillar +114 purpur_block +115 purple_wool +116 purple_terracotta +117 purple_stained_glass_pane +118 purple_stained_glass +119 purpur_shulker_box +120 purple_dye +121 purple_concrete_powder +122 purple_carpet +123 purple_bed_from_white_bed +124 purple_bed +125 purple_banner +126 pumpkin_seeds +127 pumpkin_pie +128 prismarine_bricks +129 prismarine +130 polished_granite +131 polished_diorite +132 polished_andesite +133 piston +134 pink_wool +135 pink_terracotta +136 pink_stained_glass_pane +137 pink_stained_glass +138 pink_dye_from_red_white_dye +139 pink_tulip +140 peony +141 pink_concrete_powder +142 pink_carpet +143 pink_bed_from_white_bed +144 pink_bed +145 pink_banner +146 quartz_pillar +147 paper +148 painting +149 orange_wool +150 orange_terracotta +151 orange_stained_glass_pane +152 orange_stained_glass +153 orange_dye_from_red_yellow +154 orange_dye_from_orange_tulip +155 orange_concrete_powder +156 orange_carpet +157 orange_bed_from_white_bed +158 orange_bed +159 orange_banner +160 observer +161 oak_stairs +162 oak_slab +163 oak_planks +164 note_block +165 nether_wart_block +166 nether_brick_stairs +167 nether_brick_slab +168 nether_brick_fence +169 nether_bricks +170 mushroom_stew +171 mossy_stone_bricks +172 mossy_cobblestone_wall +173 mossy_cobblestone +174 minecart +175 melon_seeds +176 melon +177 map +178 magma_cream +179 magma_block +180 magenta_wool +181 magenta_terracotta +182 magenta_stained_glass_pane +183 magenta_stained_glass +184 magenta_dye_from_purple_and_pink +185 magenta_dye_from_lilac +186 magenta_dye_from_blue_red_pink +187 magenta_dye_from_blue_red_white_dye +188 magenta_dye_from_allium +189 magenta_concrete_powder +190 magenta_carpet +191 magenta_bed_from_white_bed +192 magenta_bed +193 magenta_banner +194 jack_o_lantern +195 lime_wool +196 lime_terracotta +197 lime_stained_glass_pane +198 lime_stained_glass +199 lime_dye +200 lime_concrete_powder +201 lime_carpet +202 lime_bed_from_white_bed +203 lime_bed +204 lime_banner +205 light_weighted_pressure_plate +206 light_gray_wool +207 light_gray_terracotta +208 light_gray_stained_glass_pane +209 light_gray_stained_glass +210 light_gray_dye_from_white_tulip +211 light_gray_dye_from_oxeye_daisy +212 light_gray_dye_from_gray_white_dye +213 light_gray_dye_from_black_white_dye +214 light_gray_dye_from_azure_bluet +215 light_gray_concrete_powder +216 light_gray_carpet +217 light_gray_bed_from_white_bed +218 light_gray_bed +219 light_gray_banner +220 light_blue_wool +221 light_blue_terracotta +222 light_blue_stained_glass_pane +223 light_blue_stained_glass +224 light_blue_dye_from_blue_white_dye +225 light_blue_dye_from_blue_orchid +226 light_blue_concrete_powder +227 light_blue_carpet +228 light_blue_bed_from_white_bed +229 light_blue_bed +230 light_blue_banner +231 lever +232 leather_leggings +233 leather_helmet +234 leather_chestplate +235 leather_boots +236 leather +237 lead +238 lapis_lazuli +239 lapis_block +240 ladder +241 jungle_slab +242 jungle_stairs +243 jungle_planks +244 jungle_fence_gate +245 jungle_fence +246 jungle_door +247 jungle_boat +248 jukebox +249 item_frame +250 iron_trapdoor +251 iron_sword +252 iron_shovel +253 iron_pickaxe +254 iron_nugget +255 iron_leggings +256 iron_ingot_from_iron_block +257 iron_ingot_from_nuggets +258 iron_hoe +259 iron_helmet +260 iron_door +261 iron_chestplate +262 iron_boots +263 iron_block +264 iron_bars +265 iron_axe +266 hopper_minecart +267 hopper +268 heavy_weighted_pressure_plate +269 hay_block +270 green_wool +271 green_terracotta +272 green_stained_glass_pane +273 green_stained_glass +274 green_concrete_powder +275 green_carpet +276 green_bed_from_white_bed +277 green_bed +278 green_banner +279 gray_wool +280 gray_terracotta +281 gray_stained_glass_pane +282 gray_stained_glass +283 gray_dye +284 gray_concrete_powder +285 gray_carpet +286 gray_bed_from_white_bed +287 gray_bed +288 gray_banner +289 granite +290 golden_sword +291 golden_shovel +292 powered_rail +293 golden_pickaxe +294 golden_leggings +295 golden_hoe +296 golden_helmet +297 golden_chestplate +298 golden_carrot +299 golden_boots +300 golden_axe +301 golden_apple +302 gold_nugget +303 gold_ingot_from_gold_block +304 gold_ingot +305 gold_block +306 glowstone +307 glass_pane +308 glass_bottle +309 furnace_minecart +310 furnace +311 flower_pot +312 flint_and_steel +313 fishing_rod +314 fire_charge +315 fermented_spider_eye +316 oak_fence_gate +317 oak_fence +318 ender_eye +319 ender_chest +320 end_rod +321 end_crystal +322 end_stone_bricks +323 enchanting_table +324 emerald_block +325 emerald +326 dropper +327 dispenser +328 diorite +329 diamond_sword +330 diamond_shovel +331 diamond_pickaxe +332 diamond_leggings +333 diamond_hoe +334 diamond_helmet +335 diamond_chestplate +336 diamond_boots +337 diamond_block +338 diamond_axe +339 diamond +340 detector_rail +341 daylight_detector +342 dark_prismarine +343 dark_oak_slab +344 dark_oak_stairs +345 dark_oak_planks +346 dark_oak_fence_gate +347 dark_oak_fence +348 dark_oak_door +349 dark_oak_boat +350 cyan_wool +351 cyan_terracotta +352 cyan_stained_glass_pane +353 cyan_stained_glass +354 cyan_dye +355 cyan_concrete_powder +356 cyan_carpet +357 cyan_bed_from_white_bed +358 cyan_bed +359 cyan_banner +360 crafting_table +361 cookie +362 compass +363 comparator +364 cobblestone_wall +365 cobblestone_slab +366 coarse_dirt +367 coal_block +368 coal +369 clock +370 clay +371 chiseled_stone_bricks +372 chiseled_sandstone +373 chiseled_red_sandstone +374 chiseled_quartz_block +375 chest_minecart +376 chest +377 cauldron +378 carrot_on_a_stick +379 cake +380 bucket +381 brown_wool +382 brown_terracotta +383 brown_stained_glass_pane +384 brown_stained_glass +385 brown_concrete_powder +386 brown_carpet +387 brown_bed_from_white_bed +388 brown_bed +389 brown_banner +390 brick_stairs +391 brick_slab +392 bricks +393 brewing_stand +394 bread +395 bowl +396 bow +397 bookshelf +398 book +399 bone_meal +400 bone_meal_from_bone_block +401 bone_block +402 oak_boat +403 blue_wool +404 blue_terracotta +405 blue_stained_glass_pane +406 blue_stained_glass +407 blue_concrete_powder +408 blue_carpet +409 blue_bed_from_white_bed +410 blue_bed +411 blue_banner +412 blaze_powder +413 black_wool +414 black_terracotta +415 black_stained_glass_pane +416 black_stained_glass +417 black_concrete_powder +418 black_carpet +419 black_bed_from_white_bed +420 black_bed +421 black_banner +422 birch_slab +423 birch_stairs +424 birch_planks +425 birch_fence_gate +426 birch_fence +427 birch_door +428 birch_boat +429 beetroot_soup +430 beacon +431 arrow +432 armor_stand +433 anvil +434 andesite +435 activator_rail +436 acacia_slab +437 acacia_stairs +438 acacia_planks +439 acacia_fence_gate +440 acacia_fence +441 acacia_door +442 acacia_boat -- cgit v1.2.3