summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol_1_8.cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* More cProtocol cleanupTiger Wang2021-04-121-355/+369
| | | | | | * Alpha sort functions * Simplify hand handling * Fix left handed mode client-side display
* Unify multiprotocol entity animationsTiger Wang2021-04-121-163/+218
|
* Streamline player abilities handlingTiger Wang2021-04-121-48/+36
| | | | | | | * Update player list gamemode on world change * Fix invisibility for spectators, use entity metadata * Populate m_World for cPlayers on load - Remove SendPlayerMaxSpeed, a duplicate of SendEntityProperties
* Fix sending incorrect date values on world changeTiger Wang2021-04-121-7/+10
| | | | Yak shave: make more things use cTickTime. Fix a couple of incorrect modulo-on-millisecond-value by making them use WorldTickAge.
* Basic elytra flight (#5124)Damián Imrich2021-04-031-8/+18
| | | | | | * Basic elytra flight Co-authored-by: 12xx12 <44411062+12xx12@users.noreply.github.com> Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
* Change TimeOfDay to WorldDate (#5160)Tiger Wang2021-03-201-4/+6
| | | | | | | * Change TimeOfDay to WorldDate * Do not wrap at 20 minutes, continue incrementing * Fixes #4737 * Fixes #5159
* Don't send ping updates one packet at a timeTiger Wang2021-03-191-4/+10
| | | | | * Use the batch update feature of the packet. * Lengthen interval between time and ping update packets (ref. http://github.com/cuberite/cuberite/issues/4082#issuecomment-348675321).
* Deduplicate WriteBlockEntityTiger Wang2021-03-181-154/+125
|
* Adding basic Banner functionality (#4806)12xx122021-03-151-7/+21
| | | | | | + Added item and block for banners Co-authored-by: 12xx12 <12xx12100@gmail.com> Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
* Do protocol decryption in-place (with CryptoAPI on Windows) (#5145)Tiger Wang2021-03-081-138/+121
|
* Adding Boss bar (#5025)12xx122021-03-051-21/+88
| | | | | + Add boss bar Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
* Mark UNREACHABLE with intrinsicsTiger Wang2021-02-201-6/+3
|
* Adds playerlist header and footer broadcasting (1.8-1.13)dImrich2021-02-061-73/+87
|
* Fix debug macro situation (#5114)Tiger Wang2021-01-261-2/+2
| | | Use the standard NDEBUG.
* MultiVersionProtocol: fix two crashesTiger Wang2021-01-191-0/+7
| | | | | | | | | | | | First one: add missing exception handler in ProcessProtocolIn Second: remove faulty logic dealing with incomplete packets. `a_Data = a_Data.substr(m_Buffer.GetUsedSpace() - m_Buffer.GetReadableSpace());` was incorrect; it attempted to apply a length derived from m_Buffer to an unrelated a_Data. Its purpose was to give cProtocol the data the client sent, minus initial handshake bytes. However, we can use the knowledge that during initial handshake, there is no encryption and every byte can be written unchanged into m_Buffer, to just call cProtocol with a data length of zero. This will cause it to parse from m_Buffer - wherein we have already written everything the client sent - with no a_Data manipulation needed. Additionally, removed UnsupportedButPingableProtocolException (use of exception as control flow) and encode this state as m_Protocol == nullptr, id est "no protocol for this unsupported version", which is then handled by cMultiVersionProtocol itself.
* Clarify cClientHandle, cPlayer ownership semanticsTiger Wang2021-01-121-11/+6
| | | | | | | | + A cPlayer, once created, has a strong pointer to the cClientHandle. The player ticks the clienthandle. If he finds the handle destroyed, he destroys himself in turn. Nothing else can kill the player. * The client handle has a pointer to the player. Once a player is created, the client handle never outlasts the player, nor does it manage the player's lifetime. The pointer is always safe to use after FinishAuthenticate, which is also the point where cProtocol is put into the Game state that allows player manipulation. + Entities are once again never lost by constructing a chunk when they try to move into one that doesn't exist. * Fixed a forgotten Super invocation in cPlayer::OnRemoveFromWorld. * Fix SaveToDisk usage in destructor by only saving things cPlayer owns, instead of accessing cWorld.
* zlib -> libdeflate (#5085)Tiger Wang2021-01-111-191/+170
| | | | | | + Use libdeflate + Use std::byte * Fix passing temporary to string_view + Emulate make_unique_for_overwrite
* Ignore CanFly flag sent by the clientmathiascode2020-12-181-6/+2
|
* Warnings improvementsTiger Wang2020-12-181-7/+5
| | | | | | | | | * Turn off global-constructors warning. These are needed to implement cRoot signal handler functionality * Add Clang flags based on version lookup instead of a compile test. The CMake config process is single threaded and slow enough already * Reduced GetStackValue verbosity + Clarify EnchantmentLevel, StayCount, AlwaysTicked, ViewDistance signedness + Give SettingsRepositoryInterface a move constructor to simplify main.cpp code - Remove do {} while (false) construction in redstone handler
* Adding new monster types to enum and saving/loading for easier future implementation (#4941)12xx122020-11-231-4/+71
| | | | | | | | | | | * added new monster types to enum added string <-> enum conversion in namespace serializer added loading functions added to saving * renamed zombie pigman to zombified piglins in enum Co-authored-by: 12xx12 <12xx12100@gmail.com> Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
* Fix cmake not adding Werror on clang, and _lots_ of warnings (#4963)peterbell102020-10-051-28/+14
| | | | | | | | | | | | | | | * Fix cmake not adding Werror on clang, and _lots_ of warnings * WIP: Build fixes * Cannot make intermediate blockhandler instance * Tiger's changes * Fix BitIndex check * Handle invalid NextState values in cMultiVersionProtocol Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
* Remove SetProperty(...cPlayer)Tiger Wang2020-10-031-2/+2
| | | | Enchantment table, anvil windows are already opened one per-player.
* Added end portal and enchanting table block entities12xx122020-09-201-6/+34
|
* Remove unused ServerPort argumentTiger Wang2020-09-181-2/+1
|
* Add State enum to protocolTiger Wang2020-09-181-14/+9
|
* Remove unused ServerPort memberTiger Wang2020-09-181-1/+1
|
* Use tracing for explosions (#4845)Tiger Wang2020-09-121-15/+9
| | | | | | | | | | | | | | | | | | | | | | | | * TNT: Implement tracing algorithm + Add intensity tracing * Fix iterating over all players to SendExplosion, even those not in range * Implemented TNT entity interaction * Fixed misaligned destruction tracing * Finalise TNT algorithm - Remove BlockArea and just use chunks Using SetBlock makes it so that we can update everything properly, and does appear to be faster. * BlockInfo learns about explosion attentuation * Rename Explodinator parameters * TNT: pull block destruction into common function Co-authored-by: Alexander Harkness <me@bearbin.net>
* Unused/duplicate function cleanupTiger Wang2020-08-291-1/+1
| | | | | * FaceIntToBlockFace in 1.8/1.9 protocol merged - Removed undefined permissions stuff in Player header
* CompressPacket: reserve CompressedSize, not the uncompressed sizeTiger Wang2020-08-211-3/+3
| | | | + Assign the length data to a_CompressedData to overwrite it, mirroring the behaviour of cByteBuffer::ReadAll
* Made cProtocol::Version, EntityMetadata enums less verboseTiger Wang2020-08-211-1/+1
|
* Add Statistics and Achievements for newer Network standards12xx122020-08-191-11/+119
|
* 1.14 connection supportTiger Wang2020-07-261-13/+13
|
* Remove some unused inclusionsTiger Wang2020-07-201-2/+0
|
* Reduce duplication in CompressPacketTiger Wang2020-07-191-42/+76
| | | | | | - Remove line 1742 that wrote data which was then immediately cleared * Store the compress/no compress threshold in a constant - Remove adding a noncompressed header in SendPacket, CompressPacket handles everything now
* Use cMultiVersionProtocol's bufferTiger Wang2020-07-181-29/+28
|
* Delete duplicated status request handlersTiger Wang2020-07-181-5/+14
| | | | Here we go again...
* 1.13 items supportTiger Wang2020-07-181-1/+1
| | | | + Add 1.16 block and item definitions
* 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