1
0
Commit Graph

18 Commits

Author SHA1 Message Date
Tobias Wilken
36eab1b323
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 <peterbell10@live.co.uk>

* 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 <peterbell10@live.co.uk>
2020-07-14 17:56:42 +01:00
Alexander Harkness
2529a89835 Golden Apple Fixes (#4130)
* Do not remove food item until player has been fed
* Golden apples now ignore hunger when eating
* Removed EnchantedGoldenApple recipe, as it was removed in 1.9
    Reference: https://minecraft.gamepedia.com/1.9#Items_2
* Adjust golden apple effects, as they were changed in 1.9
    Reference: https://minecraft.gamepedia.com/1.9#Items_2
2018-01-06 00:39:23 +00:00
Lukas Pioch
885d828712 Added bed entity (#3823)
* Added bed entity

* Export cBedEntity to lua
* Set color of bed through item damage value
* Added bed entity to APIDoc
* NBT: Added loading and saving
* Crafting recipes for the colored beds
2017-07-07 09:31:45 +02:00
Bond-009
7fd3899796 Added 1.12 blocks (#3760) 2017-06-30 10:46:58 +02:00
mathiascode
6176019911 Added 1.11 blocks, items and recipes (#3500) 2016-12-30 00:02:28 +01:00
Mathias
c2727a45ad Added blocks and crafting recipes 2016-11-12 01:43:47 +02:00
hangyas
911aed26d8 remove hopper from dropper's recipe (#3374) 2016-09-07 21:53:26 +03:00
jammet
722b09adde Fixed NetherBrick recipes (#3306)
Again.
2016-08-10 08:34:26 +01:00
Alexander Harkness
fea664f2cf Some 1.9 Crafting Recipes and Items. (#3199) 2016-05-20 09:33:56 +02:00
LogicParrot
f73de02684 Added "Chissled Stone Bricks" recipe (#3192) 2016-05-15 17:40:52 +03:00
Mathias
9c3b88d663 Fixed melon block recipe 2016-03-14 19:36:46 +02:00
LogicParrot
d0f815a64f Alphabetically sorted configuration files 2016-01-17 11:39:54 +02:00
jammet
4127d61284 Update crafting.txt
Added Mossy Cobblestone recipe
2016-01-17 01:44:52 +01:00
Gargaj
fb69688fe9 fix crafting recipe for snow layers 2015-12-26 16:49:40 +01:00
Mathias
a72318bbc3 Added 1.7 item names 2015-12-22 23:19:35 +02:00
Mathias
671e81966b Fixed a few crafting recipes 2015-12-12 18:39:01 +02:00
Gargaj
2971758df3 add Golden Carrot
Yay!
2015-11-23 17:39:40 +01:00
Mattes D
dac97826f7 Renamed output directory to Server 2015-09-05 22:01:21 +02:00