| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
| |
* replace push_back with emplace_back when a new object was created in the function call
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
| |
due to overlooked fallthrough
|
|
|
|
|
| |
+ Add static keyword
- Don't capture everything in lambda
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Rewrite to use wiki target/sacrifice terminology.
* Fix negative damages.
* Prevent repairing if output matches target.
* Make target and sacrifice const.
* Pre-PR tidy-up
* Keep m_MaximumCost updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
|
|
|
| |
Enchantment table, anvil windows are already opened one per-player.
|
|
|
|
|
| |
* Use lapis for enchanting, subtract correct number of levels, ClientHandle now selects from pregenerated list.
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
|
|
| |
* 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
|
| |
|
| |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
This is my attempt to fix #4112. The root cause of the issue was that the lapis slot was treated exactly the same as the enchanting slot, so it on the server side it would only ever slot one item.
My fix is to check if its the second slot in the window, then check if it's lapis (it would slot whatever). If it is lapis I call the base click handler.
|
|
|
|
|
|
|
| |
* Replace cWorld::FindClosesPlayer with cWorld::DoWithClosestPlayer
* Implement experience reward splitting into the orb sizes used in vanilla
* Modified speed calculation in cExpOrb::Tick to make the orbs fly towards the player
Fixes #4216
|
|
|
| |
Ref: https://github.com/cuberite/cuberite/pull/4264#discussion_r204769193
|
|
|
|
| |
Add check for number of empty lines between functions and fix the corresponding failures
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Smelting Exp
Smelting now gives experience
* Furnace.txt update
Exp rewards are entered in furnace.txt, Reward calculation is now done
is the furnaceentity class
* furnace.txt update
Changed alignment tabs to spaces
Included documentation of exp in recipe
* Updated StringToFloat
changed strtod to strtof
* Explicit Float to Int
* Reworked Smelting Rewards
* No C casts
-Adds new function to the api
-Sets reward counter to 0 in furnace constructor
* Style and exp lock removed
-Fixed style mistakes accoring to PR notes
-XP isn't locked to a single player anymore
* No Smelter API
-Removed SetLastSmelter and GetLastSmelter
-Fixed comments
-Fixed log reward amounts
|
|
|
|
|
|
|
|
|
|
| |
* Implement horse inventory
* Fix sign conversions
* Add API doc for ItemCategory::IsHorseArmor
* Improve HandleOpenHorseInventory comment and style fixes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
| |
|
|
|
| |
+ Added anvil enchantment handling.
|
| |
|
| |
|
|
|
| |
The original bindings accepted nil as the World param, causing a crash.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Fixes #2603
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
|
| |
|
| |
|
| |
|
| |
|
|
|
| |
This fixes many visual bugs.
|
| |
|
|\
| |
| |
| |
| | |
Conflicts:
src/OSSupport/Thread.cpp
|
| | |
|
|\| |
|
| | |
|
| | |
|
|/ |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
This was mostly done automatically and then visually inspected for obvious errors.
All //-style comments should have a 2-space separation from the code, and 1 space after the comment sign.
|
|\
| |
| | |
Add more inventory actions.
|
| | |
|
| | |
|
| | |
|
| | |
|
|/
|
|
| |
Fixes #1152.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|\
| |
| | |
Statistic Manager
|
| | |
|
|/ |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|\
| |
| |
| |
| | |
Bug fixes and optimizations.
We need to visit the API functions and check that they return only those values expected. `cWorld::CreateProjectile()` seems affected, too, by the same issue of ToLua returning extra values. In the cleanest form, these functions will need moving to ManualBindings.cpp
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| | |
Thanks to Howaner for helping
|
| | |
|
| |
| |
| |
| | |
Code by LO1ZB
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| | |
http://minecraft.gamepedia.com/Enchantment_mechanics
|
|\| |
|
| | |
|
| | |
|
| | |
|
|/
|
|
|
|
|
|
| |
- 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...
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
+ Added custom names and lore
+ Added saving and loading
+ Added writing and parsing of NBT
|
| |
|
| |
|
| |
|
|
|
|
| |
Note that they just mirror chests now, so no per player inventory.
|
|
|