summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol_1_8.cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Introduce recipe book functionality (#4493)Tobias Wilken2020-07-141-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Made grass spreader prettierTiger Wang2020-07-061-1/+1
|
* Protocol: Avoid crashing on invalid sign textPeter Bell2020-05-291-1/+1
|
* Enable some more clang-tidy linter checks (#4738)peterbell102020-05-151-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Avoid inefficient AString -> c_str() -> AString round trip * Avoid redundant string init expressions * Avoid unnecessary return, continue, etc. * Add .clang-format to help with clang-tidy fix-its * Avoid unnecessary passing by value * Avoid unnecessary local copying * Avoid copying in range-for loops * Avoid over-complicated boolean expressions * Some violations missed by my local clang-tidy * Allow unnecessary continue statements * Add brackets * Another expression missed locally * Move BindingsProcessor call into clang-tidy.sh and add space * Fix pushd not found error * Different grouping of CheckBlockInteractionRate
* Update submodules (#4727)peterbell102020-05-091-8/+5
| | | | | | | | | | | | | Closes #4708 This updates jsoncpp, mbedtls, TCLAP and SQLiteCpp to their latest stable release. A few additional changes were needed: * jsoncpp deprecated Reader, FastWriter and StyledWriter which I've replaced with some helper functions in JsonUtils.cpp * SQLiteCpp changed how it builds with external sqlite libraries, now expecting them to be installed. The simplest path was to remove sqlite from cuberite's submodule and just use SQLiteCpp's internal version.
* Fixed various MSVC warnings.Mattes D2020-05-061-0/+1
|
* Fix one definition rule violationsTiger Wang2020-05-041-7/+3
|
* Improve entity position updates (#4701)Tiger Wang2020-05-041-79/+94
| | | | | | | | | * Make puking pickups fly nicer * Improve entity position updates * Move determination of whether a delta is too big for a packet into the protocol handlers + Less jittery movement + Generalise CollectEntity to take any entity
* Unify entity spawn packet sendingTiger Wang2020-05-011-186/+167
|
* Unify 1.8 and 1.9Tiger Wang2020-04-221-47/+90
| | | | - Deleted ridiculous amount of duplicated code
* Delet SpawnObject paramsTiger Wang2020-04-201-1/+1
| | | | | | * Fix #4679 awkward...
* Using Super.Mattes D2020-04-161-1/+1
|
* Fix compilation, for real this time.Alexander Harkness2020-04-101-0/+1
| | | | I should go to sleep now...
* Add Zombie VillagersBond-0092020-04-101-2/+14
|
* Initial resource pack support (#4622)Mat2020-04-071-0/+31
|
* Implement wither skeletons (#4563)Mat2020-04-041-8/+8
|
* Pulled the BlockID and BlockInfo headers from Globals.h. (#4591)Mattes D2020-04-031-2/+2
| | | | | | | | | The BlockID.h file was removed from Globals.h and renamed to BlockType.h (main change) The BlockInfo.h file was removed from Globals.h (main change) The ENUM_BLOCK_ID and ENUM_ITEM_ID enum names were replaced with ENUM_BLOCK_TYPE and ENUM_ITEM_TYPE (cosmetics) The various enums, such as eDimension, eDamageType and eExplosionSource were moved from BlockType.h to Defines.h, together with the helper functions for converting between them and strings (StringToDimension et al.) (minor) Many inline functions were moved from headers to their respective cpp files, so that BlockType.h could be included only into the cpp file, rather than the header. That broke our tests a bit, since they pick bits and pieces out of the main code and provide stubs for the rest; they had to be re-stubbed and re-verified. eMonsterType values are no longer tied to E_ITEM_SPAWN_EGG_META_* values
* Add protocol mob ID remapping (#4538)Mat2020-03-291-1/+47
|
* Fix build on ClangAlexander Harkness2020-03-281-4/+4
|
* Inventory changes (#4561)Mat2020-03-281-6/+6
| | | Co-Authored-By: peterbell10 <peterbell10@live.co.uk>
* Added temporary block type mapping for 1.13+ protocols.Mattes D2020-01-071-1/+1
|
* Protocol: Use logical outgoing packet types.Mattes D2019-09-101-99/+179
|
* Fix building with clang 8.0 (#4346)Bond-0092019-08-111-10/+14
|
* Force all headers other than "Globals.h" to be included with relative paths (#4269)peterbell102018-08-291-2/+2
| | | | | | | Closes #4236 CMake now creates a header file in the build directory under the path "include/Globals.h" which just includes "src/Globals.h" with an absolute path. Then instead of adding "src/" to the include directories, it adds "include/". #include "Globals.h" still works by including the build generated file and any other src-relative path will not work.
* Store and pass entity effect duration as an int not a short. (#4293)Alexander Harkness2018-08-261-4/+1
| | | Fixes #4292.
* CheckBasicStyle: Check number of empty lines between functions (#4267)peterbell102018-07-261-0/+3
| | | | Add check for number of empty lines between functions and fix the corresponding failures
* Keep players in gmNotSet (#4248)changyong guo2018-07-231-2/+2
| | | | This allows players game mode to update to the default after portal to another world. Fixes #4207
* recover hotbar selected slot after reconnect (#4249)changyong guo2018-07-231-0/+13
| | | | | | | 1. implement protocol message SendHeldItemChange 2. add save / load inventory equipped item slot in JSON 3. send held item slot message after player connect to server Fixes #4189
* Prefer static_cast to reinterpret_cast (#4223)peterbell102018-05-021-36/+36
| | | | | | | * Change reinterpret_cast -> static_cast wherever possible * Remove more unnecessary `const_cast`s. reinterpret_casts should be avoided for the same reason as c-style casts - they don't do any type-checking. reinterpret_cast was mainly being used for down-casting in inheritance hierarchies but static_cast works just as well while also making sure that there is actually an inheritance relationship there.
* Rewrite cClientHandle::HandleRightClick (#4089)9caihezi2018-01-081-2/+10
| | | | | | | | | | | | | * Add hand parameter to distinguish main hand/off hand. * Add a new function cClientHandle::HandleUseItem to separate the functionality of using an item without a target block. This matches the protocol with client version >= 1.9 * Always actively update the status of a block if the placement fails (by out of reach or rejected by plugin). * Do not call plugin callback CallHookPlayerRightClick(-1, 255, -1, -1, 0, 0, 0) when using item. The CallHookPlayerUsingItem will still be called. Now at most one of CallHookPlayerRightClick, CallHookPlayerUsingBlock, CallHookPlayerUsingItem and CallHookPlayerEating will be called based on the type of action (not including the used version of callbacks). * Do not count using item as BlockInteractionsRate check (Using item takes time). * Now we can open chests(etc.) when sneaking as long as the player's hand is empty. This is what vanilla server does.
* Add the fmt library (#4065)peterbell102018-01-031-5/+5
| | | | | | | * Replaces AppendVPrintf with fmt::sprintf * fmt::ArgList now used as a type safe alternative to varargs. * Removed SIZE_T_FMT compatibility macros. fmt::sprintf is fully portable and supports %zu. * Adds FLOG functions to log with fmt's native formatting style.
* Store Health as a float (#4073)Fabian2017-11-221-1/+1
| | | | | | | | | | | | | | | | | | * Fix #4024 * Fix clang error * Add comment * Fix behaviour * Save Health as float * Changed m_Health to float * Remove redundant static_cast * Fix casts
* Implement horse inventory (#4053)peterbell102017-10-211-1/+4
| | | | | | | | | | * Implement horse inventory * Fix sign conversions * Add API doc for ItemCategory::IsHorseArmor * Improve HandleOpenHorseInventory comment and style fixes.
* Fix switch warnings (#4013)peterbell102017-09-141-16/+18
| | | | | | | | | | | | | | | * Fix switch warnings * Fix a variety of -Wswitch and -Wswitch-enum warnings * Remove unneeded -Wno-error flags * Reorganise some eMonsterType switches * Alpha sort eMonsterType cases in WriteMobMetadata and in cNBTChunkSerializer::AddMonsterEntity * List all mob types in protocol 1.12 and NBTChunkSerializer * cStructGenTrees::GetNumTrees: remove switch default * cWSSAnvil::LoadOldMinecartFromNBT: Log unhandled minecart type
* Protocol Spawn Position Should Use LastSentPosition (#3929)Lane Kolbly2017-08-301-12/+16
| | | | | | + Added GetLastSentPos * Fixed spawn position bug in 1.8.
* Update mbedtls to 2.5.1 (#3964)peterbell102017-08-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | * Renaming changes: * macro prefix "POLARSSL" -> "MBEDTLS" * functions now prefixed with "mbedtls_" * rename PolarSSL++ -> mbedTLS++ * rename polarssl submodule * Use mbedtls' AES-CFB8 implementation. * Add cSslConfig to wrap mbedtls_ssl_config * Update cTCPLink and cBlockingSslClientSocket to use cSslConfig * Use cSslConfig in cHTTPServer * Use cSslConfig for cMojangAPI::SecureRequest * CI Fixes * Set -fomit-frame-pointer on the right target
* Implement Forge protocol handshake support (#3869)satoshinm2017-08-271-0/+1
|
* Don't assert when placing beds in older versions (#3916)mathiascode2017-08-251-0/+1
|
* Add cUUID class (#3871)peterbell102017-08-251-5/+10
|
* Minor changes (#3909)mathiascode2017-08-241-1/+1
|
* Fully implemented leashes (#3798)Pablo Beltrán2017-08-211-0/+28
|
* Represent cItem::m_Lore as an AStringVector (#3882)peterbell102017-08-181-13/+3
| | | | | | | | * Replace cItem::m_Lore with AStringVector * Reword deprecation warning * Fix lua bindings
* cParsedNBT: Improved error reporting (#3876)peterbell102017-07-301-1/+3
| | | | | | * cParsedNBT: Improved error reporting * Fix typos
* Tentative fix for player-limit race condition (#3862)Tiger Wang2017-07-281-3/+3
| | | | | | | | | | * Attempts to fix #2257 Derived from d233e9843148313c71fbaba96ccff660e47b07b1 * Changed player count type to int * Clarified certain actions
* Handle middle mouse drag (#3847)peterbell102017-07-131-0/+3
|
* Use FastWriter instead of StyledWritermathiascode2017-05-161-1/+1
|
* Corrected particles (#3577)mathiascode2017-02-261-13/+9
| | | Fixes wrong IDs causing particles to become unknown to the server.
* Added some blocks and items (#3503)mathiascode2017-02-141-0/+10
|
* Fixed ClientHandle:GetProtocolVersion returning wrong number.Mattes D2017-01-281-2/+2
|
* Track skin part and main hand preferences (#3498)Pokechu222017-01-031-3/+17
|
* Initial support for the 1.11 protocol.Mattes D2016-12-161-0/+3623