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.
Problem: On a new server the players folder was not created on windows.
Root Cause:
`GetUUIDFolderName` was returning a folder structure for players with `/` while CreateFolderRecursively was checking for `\\` for win32.
The fix is to recognise both forward and backward slashes as file separators on windows.
Fixes#4284
* 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
Along with a call to `destroyentities`, this fixes#4271
I'm guessing the intention of this code was to modify the normal spawning of ocelots. However, `cEntity::SpawnOn` is actually called to send the entity to an individual client. That means this code was run for every single player, every time they were sent a chunk with ocelots in it. Thus, the ocelots population would grow exponentially as players log in and move around.
* Move Broadcast functions from cChunkMap to cBroadcaster
- Remove cBroadcastInterface in favour of cBroadcaster.
- cChunk: Remove broadcast functions.
* resurect broadcast interface
* Absorb cBroadcaster into cWorld.
Removes the need for forwarding the function calls.
* Improve const-correctness
* Use Int8 instead of char
+ Comment `ForClients` functions
* Improve comments
* Broadcaster: Rename ForClients functions
Closes#1244
Initially I was just going to add the cChunkData to cSetChunkData but profiling revealed
that the copying wasn't even the biggest slowdown. Much more time was being spent in
cChunk::CreateBlockEntities and cChunk::WakeUpSimulators than was in memcpy so I've made
those significantly faster as well.
Optimisations performed:
* cSetChunkData now stores blocks in a cChunkData object
* cChunkData objects can now perform moves even if they are using different pools
* cChunk::CreateBlockEntities now iterates in the correct order and only over present chunk sections
* Similarly for cChunk::WakeUpSimulators
* cSetChunkData::CalculateHeightMap now shortcuts to the highest present chunk section before checking blocks directly
1. Base knockback on an entity's bounding box intersection with the explosion
2. Armor blast protection reduces knockback
3. Don't apply knockback to players flying in creative mode
Fixes#4139
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
When generating foliage, create cacti with height in the interval [1; MaxCactusHeight] and sugarcane with height in [1; MaxSugarcaneHeight] (with MaxCactusHeight and MaxSugarcaneHeight declared in world.ini)
Fixes#4135
* 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.
Fixes ["Fishing Speed Too Slow"](https://forum.cuberite.org/thread-3175-post-29000.html#pid29000).
Interestingly, the constants @NiLSPACE points out are actually correct:
```cpp
(Random.RandInt(100, 900) - static_cast<int>(a_Player->GetEquippedItem().m_Enchantments.GetLevel(cEnchantments::enchLure) * 100))
```
100 to 900 ticks is the correct timing of 5-45 seconds. However, the timer is only updated when the floater is in the water and the server side position was actually bobbing in and out of the water. This meant the timer took ~2-3x longer than it should.
With this change the floater position is always in the water and so the timer works as expected.
* 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
Fixes#4040
* The TCP connection is now shutdown after OnBodyFinished
* Any open connections are closed when cNetworkSingleton::Terminate() is called.
* Removed ownership cycles in cUrlClientRequest
* Added a check to the test to ensure there are no leaks.
* Fixes a number of "<function>: not all control paths return a value" warnings on MSVC.
* Introduces the UNREACHABLE global macro and uses it instead of conditionally compiled switch defaults.
* Move cNBTParseErrorCategory from FastNBT.h into FastNBT.cpp to prevent bad calls to message()