1
0
Fork 0
Commit Graph

47 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
MaxwellScroggs 5cdaf073be
cWindow: Convert XYZ to Vector3 (#4764) 2020-07-04 23:49:17 +02:00
Mattes D 9ee47e5999 Using Super. 2020-04-16 20:07:48 +00:00
peterbell10 0bacda3269 Implement horse inventory (#4053)
* Implement horse inventory

* Fix sign conversions

* Add API doc for ItemCategory::IsHorseArmor

* Improve HandleOpenHorseInventory comment and style fixes.
2017-10-21 17:56:09 +01:00
Lukas Pioch 743a50014a Replaced includes with forward declarations 2017-08-13 12:31:10 +01:00
Pablo Beltrán 84bdba345d Off-hand/shield slot functional, save and load slot, bow + arrow functional (#3725)
Fixes #3714.
2017-05-24 08:09:58 +02:00
Lukas Pioch e35ac1bfb9 Clang 5.0 fixes
- Added override keyword
- Removed inherited member variables
2017-05-21 12:19:06 +02:00
Lukas Pioch 41bfb22834 Corrected brewingstand and added support for fuel 2017-05-08 06:30:54 +02:00
Mattes D cbff1378fd Fixed bindings for cBlockArea:Read and Write. (#3568)
The original bindings accepted nil as the World param, causing a crash.
2017-02-05 16:00:38 +01:00
LogicParrot ca6ef58b1e Bulk clearing of whitespace 2016-02-05 23:50:18 +02:00
Lukas Pioch 9749c3aac9 Implemented brewing 2015-11-03 18:00:55 +01:00
Mattes D 6e4122e551 Unified the doxy-comment format. 2015-07-31 16:49:10 +02:00
Samuel Barney 804805d35a Silenced and fixed many warning messages across multiple files. 2015-07-29 09:49:30 -06:00
Lukas Pioch e30b2ed487 Fixed missing overrides and added a ignore flag for reserved macro for clang version 3.6 and higher. 2015-05-23 16:28:37 +02:00
Mattes D c13b1931ff More style checking.
Spaces around some operators are checked.
2015-05-09 12:58:54 +02:00
Mattes D cc069ccb2a Changed cEntity::m_UniqueID to UInt32. 2015-03-21 15:18:17 +01:00
Howaner 8591935a4b Implemented vanilla-like shift click.
This fixes many visual bugs.
2014-12-13 18:49:11 +01:00
Howaner b6fd400276 Own classes for all windows. 2014-12-13 15:06:55 +01:00
Tiger Wang bc37b895bc e.t.c. -> etc.
etcetera, not egg tray conglomerate :P
2014-09-13 11:15:16 +01:00
Tiger Wang a8c7dadfd7 Added newlines 2014-09-13 11:14:17 +01:00
Tiger Wang 3e74113427 Implemented Chest Minecarts 2014-09-12 23:18:02 +01:00
Hownaer 0f1fd33123 Enchanting table improvements. 2014-08-28 01:21:54 +02:00
Howaner 89b1bbdc5f Added beacon. 2014-07-30 21:59:35 +02:00
Howaner 897d68dc35 Add armor items directly to the armor slots. 2014-07-20 01:22:58 +02:00
madmaxoft c03161f75d Fixed tabs used for alignment. 2014-07-17 23:16:55 +02:00
Mattes D ea24a4f4aa Merge pull request #1157 from Howaner/Window
Add more inventory actions.
2014-07-09 23:27:02 +02:00
Howaner 3615bf825b Added inventory number click. 2014-07-09 14:30:06 +02:00
Mattes D 562d14e8ec Fixed crafting grid updating.
Fixes #1152.
2014-07-06 14:42:28 +02:00
Howaner 9d7a59012c Added drop window action. 2014-07-06 00:40:59 +02:00
Howaner 7a78f23b4a Add middle click. 2014-07-05 14:00:04 +02:00
Howaner 12f3c0fcdf Players can't set items in the result slot, when they shift a item. 2014-06-01 00:50:35 +02:00
andrew b3d2b5b2c9 cEntity::Killed(cEntity *) Handler; Achievement triggers; cPlayer::AwardAchievement() 2014-05-12 17:05:09 +03:00
Howaner c162d69e7b Add doxycomments to cSlotAreaAnvil functions. 2014-05-05 17:34:41 +02:00
Howaner ecc62dbb9c Add anvil shift click. 2014-05-05 17:34:35 +02:00
Howaner 7fe6e40bf7 Add clicks, exp subtraction, item check, ... 2014-05-05 17:34:29 +02:00
Howaner 6ac332cd06 Add MC|ItemName plugin message. 2014-05-05 17:34:24 +02:00
Howaner 3c102870f6 Add anvil window and slot area. 2014-05-05 17:34:17 +02:00
Howaner 9cbb3a339f Fix armor in survival mode. 2014-04-24 20:41:25 +02:00
Howaner e81fc2779e Add more checks to cSlotAreaEnchanting 2014-04-15 21:12:59 +02:00
daniel0916 b5401ec03a Added ItemPlaceCount in SlotArea
Thanks to Howaner for helping
2014-04-14 22:05:04 +02:00
daniel0916 a51a099c81 Blocked enchanting a item twice 2014-04-14 13:39:44 +02:00
daniel0916 856e900bf8 Bug fixes 2014-04-14 11:48:12 +02:00
daniel0916 2e9754ac1c Merge remote-tracking branch 'upstream/master' into Enchanting 2014-04-07 20:12:17 +02:00
madmaxoft 1826461884 Fixed multiple gcc warnings about unused params. 2014-02-28 16:26:23 +01:00
daniel0916 0c2b307eab first changes for enchanting (not finished)
- added enchanting table block handler and added it to the blockhandler
- added enchanting window
- drop item in the slot 0 when the player close the window
- added enchanting packet (1.7 only)
- some more...
2014-01-20 18:22:08 +01:00
Tiger Wang 347e80bdd8 Added basic ender chests
Note that they just mirror chests now, so no per player inventory.
2013-12-07 00:18:58 +00:00
Alexander Harkness 675b4aa878 Moved source to src 2013-11-24 14:19:41 +00:00