summaryrefslogtreecommitdiffstats
path: root/src/Inventory.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fixed Compiler Warningsx12xx12x2022-01-141-3/+3
|
* Introduce recipe book functionality (#4493)Tobias Wilken2020-07-141-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Replace buckets to the selected hotbar slot, rather than the first available. (#4580)Alexander Harkness2020-04-021-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | * Replace buckets to the selected hotbar slot, rather than the first available. Replicates vanilla behaviour, as well as being more logical. * Refactor cInventory::AddItem. Behaviour is now documented * Add new cInventory::ReplaceOneEquippedItem and ::SetEquippedItem methods * Return empty potion to the same slot after drinking * Replace buckets correctly in other situations, not simply water and lava Uses the new ReplaceOneEquippedItem method * Correct collecting water from source block with bottle * Add cPlayer::ReplaceOneEquippedItemTossRest method * Handle stacked filled buckets (in theory) Use new cPlayer::ReplaceOneEquippedItemTossRest method
* Removed unused forward declarations (#3888)Lukas Pioch2017-08-031-1/+0
|
* Off-hand/shield slot functional, save and load slot, bow + arrow functional (#3725)Pablo Beltrán2017-05-241-2/+19
| | | Fixes #3714.
* Clang 5.0 fixesLukas Pioch2017-05-211-1/+1
| | | | | - Added override keyword - Removed inherited member variables
* Updated API documentation.Mattes D2016-07-181-2/+2
|
* Bulk clearing of whitespaceLogicParrot2016-02-051-25/+25
|
* Fixes #2052Tiger Wang2015-05-181-8/+2
|
* CheckBasicStyle: checks spaces around * and &.Mattes D2015-05-091-1/+1
|
* Removed unwanted base classes from Lua API.Mattes D2015-03-191-0/+2
|
* En masse NULL -> nullptr replaceTiger Wang2014-10-231-2/+2
|
* Gave names to unnamed enumsarchshift2014-08-111-2/+2
|
* Style: Normalized to no spaces before closing parenthesis.madmaxoft2014-07-211-1/+1
|
* Clarified RemoveItem()'s comments.madmaxoft2014-07-181-1/+2
|
* Added RemoveItem() function to the player inventory.Howaner2014-07-181-0/+3
|
* Fixed basic whitespace problems.madmaxoft2014-07-171-1/+1
| | | | Indenting by spaces and alignment by spaces, as well as trailing whitespace on non-empty lines.
* Add DIG_STATUS_CANCELLED packet and add item resend, when a block can't place/break.Howaner2014-05-091-19/+22
|
* Fixed non-virtual destructors warnings.madmaxoft2014-03-281-0/+2
|
* Map item handler; Fixed several bugsandrew2014-02-171-0/+3
|
* Moved source to srcAlexander Harkness2013-11-241-0/+182