summaryrefslogtreecommitdiffstats
path: root/src/ItemGrid.cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Introduce recipe book functionality (#4493)Tobias Wilken2020-07-141-4/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* cItemGrid: Allocate storage lazily (#4083)peterbell102018-01-211-75/+113
| | | | | * cItemGrid: Allocate storage lazily * cItemGrid: Fix spelling, Prioritary -> Priority
* cItemGrid bounds check (#3837)peterbell102017-07-091-12/+62
|
* BlockEntities: Support cloning self.Mattes D2017-06-161-0/+16
|
* Bulk clearing of whitespaceLogicParrot2016-02-051-13/+13
|
* Silenced and fixed many warning messages across multiple files.Samuel Barney2015-07-291-3/+3
|
* Made -Weverything an error.tycho2015-05-241-1/+1
|
* Fixed a possible division by zero.Mattes D2014-12-211-1/+1
|
* Moved all Noise-related files into a separate folder.Mattes D2014-11-181-1/+1
|
* En masse NULL -> nullptr replaceTiger Wang2014-10-231-1/+1
|
* Fixed minor style issues.Mattes D2014-10-191-1/+1
|
* Changed i variable to jSTRWarrior2014-10-161-3/+10
| | | | The server wasn't going over all the items before.
* The code now prevents conflicting enchantments.STRWarrior2014-10-151-0/+1
|
* Adding enchantments directly instead of first getting the name of it.STRWarrior2014-10-151-1/+1
|
* Renamed the counter to 'j'STRWarrior2014-10-151-1/+1
|
* Returned cFastRandom and cEnchantment:GetRandomEnchantmentFromVector to beforeSTRWarrior2014-10-151-1/+1
| | | | Added cEnchantment:GenerateEnchantmentFromVector that allows to get the same enchantments over and over.
* Enchanted books generate in MineShafts chestsSTRWarrior2014-10-151-1/+14
|
* Merge branch 'master' into InventoryHowaner2014-07-261-0/+33
|\
| * Added RemoveItem() function to the player inventory.Howaner2014-07-181-0/+33
| |
* | Items should first added to the first slot, not the latest.Howaner2014-07-181-3/+3
|/
* Nullify deleted pointers.archshift2014-06-191-0/+1
|
* Changed inheritance a bitTiger Wang2014-02-121-0/+7
| | | | * cBlockEntityWithItems now inherits from cBlockEntityWindowOwner
* Removed obsoleted functionsTiger Wang2014-01-161-4/+4
|
* Fixed signedness warning in cItemGrid.madmaxoft2013-12-221-3/+3
|
* Moved source to srcAlexander Harkness2013-11-241-0/+665