summaryrefslogtreecommitdiffstats
path: root/src/Inventory.cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* ItemHandler initialisation is a constant expression (#5344)x12xx12x2021-12-021-4/+3
| | | | | * Transition to non-pointer item handler * That is my destructor - I decide when I leave this world * I declare your destruction private and you final
* Introduce recipe book functionality (#4493)Tobias Wilken2020-07-141-4/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-18/+74
| | | | | | | | | | | | | | | | | | | | | | | | * 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
* CheckBasicStyle: Check number of empty lines between functions (#4267)peterbell102018-07-261-0/+2
| | | | Add check for number of empty lines between functions and fix the corresponding failures
* Fix typo in #4095.Alexander Lyons Harkness2017-12-211-2/+1
| | | | The build was being broken.
* cInventory: Add listener to shield slot. (#4095)peterbell102017-12-211-0/+6
|
* Off-hand/shield slot functional, save and load slot, bow + arrow functional (#3725)Pablo Beltrán2017-05-241-7/+50
| | | Fixes #3714.
* Proper entity destruction in non-ticking chunksLogicParrot2016-02-191-1/+1
|
* Bulk clearing of whitespaceLogicParrot2016-02-051-16/+16
|
* Fix old style casts and implicit conversionsMatti Hänninen2015-08-121-1/+1
|
* Silenced and fixed many warning messages across multiple files.Samuel Barney2015-07-291-3/+3
|
* Improved mapsTiger Wang2015-07-141-14/+2
|
* Merge branch 'master' into PreventNewWarningstycho2015-05-281-5/+26
|\ | | | | | | | | Conflicts: src/Inventory.cpp
| * Fixes #2052Tiger Wang2015-05-181-4/+26
| |
* | Make -Werror disabling file onlytycho2015-05-191-1/+1
|/ | | | Ad fix a load of warnings
* CheckBasicStyle: checks spaces around * and &.Mattes D2015-05-091-1/+1
|
* Fixed reported parentheses around comparisons.Mattes D2014-12-051-2/+6
|
* En masse NULL -> nullptr replaceTiger Wang2014-10-231-6/+6
|
* Type warning fixes.Mattes D2014-08-251-1/+1
|
* Merge pull request #1236 from Howaner/Inventory2Mattes D2014-07-271-6/+10
|\ | | | | Fix item durability.
| * Fix item durability.Howaner2014-07-231-6/+10
| | | | | | Fixes #1181
* | Merge branch 'master' into InventoryHowaner2014-07-261-10/+28
|\|
| * Style: Normalized to no spaces before closing parenthesis.madmaxoft2014-07-211-8/+8
| |
| * Style: Normalized spaces after if, for and while.madmaxoft2014-07-211-7/+7
| |
| * Added RemoveItem() function to the player inventory.Howaner2014-07-181-0/+18
| |
* | Add armor items directly to the armor slots.Howaner2014-07-201-0/+13
| |
* | Fixed the armor slot in creative mode. Also removed that armor get directly to the armor slot. It is extremely buggy and unnecessary.Howaner2014-07-181-9/+0
|/
* Fixed spaces around single-line comments.madmaxoft2014-07-171-2/+2
| | | | There should be at least two spaces in front and one space after //-style comments.
* Add DIG_STATUS_CANCELLED packet and add item resend, when a block can't place/break.Howaner2014-05-091-0/+10
|
* Send item back to the client when the item get damage.Howaner2014-05-071-0/+1
|
* Broadcast the Equipped Item, if the Slot is changed.Howaner2014-03-061-0/+6
|
* Map item handler; Fixed several bugsandrew2014-02-171-0/+25
|
* Removed obsoleted functionsTiger Wang2014-01-161-1/+1
|
* fixed warnings in Inventory.cppTycho Bickerstaff2013-12-311-2/+2
|
* Fixed VC2008 compilation, normalized include paths.madmaxoft2013-11-271-1/+1
|
* Fixed loads more of them.Alexander Harkness2013-11-261-1/+1
|
* Attempt to fix compilationTiger Wang2013-11-241-1/+1
|
* Moved source to srcAlexander Harkness2013-11-241-0/+682