1
0
Commit Graph

5668 Commits

Author SHA1 Message Date
Mat
599d42e6d3
Prevent arrows from sinking into the ground (#4509) 2020-03-19 09:58:20 +00:00
Mat
47fa636e34
Change outdated air drag value for arrows 2020-03-19 04:47:54 +02:00
Mat
5869a53e21
Change outdated air drag value for TNT 2020-03-19 04:35:21 +02:00
Max Luchterhand
384ba18812
Fixed unloading of chunks that contain player entities (#4508)
Co-authored-by: peterbell10 <peterbell10@live.co.uk>
Co-authored-by: mluchterhand <mluchterhand@max.de>
2020-03-18 17:17:59 +00:00
Max Luchterhand
57da82524b
Blocks only drop pickups when using correct tool (#4505)
Co-authored-by: mluchterhand <mluchterhand@max.de>
2020-03-18 16:59:28 +00:00
Mat
0718c44e77
Silk touch pickaxe drops grass block (#4485) 2020-03-17 02:23:50 +02:00
Mat
5a2163d7e6
Don't send entity velocity for boats (#4488)
* Don't send entity velocity for boats
2020-03-07 13:56:02 +02:00
Mat
83a41c93e9
Attached entities can't enter portals (#4484)
* Attached entities can't enter portals

* Whitespace fixes
2020-03-05 21:33:43 +02:00
Mat
d572ad7faf
Don't spawn boats in ground 2020-03-05 16:05:30 +02:00
Mat
cff9f7571b
Use LastSentPos for mob spawn packet in 1.11+ (#4490) 2020-03-05 12:58:46 +02:00
Mat
7d4934534e
Stabilise MoveToWorld (#4004)
* Stabilise MoveToWorld

* Fix comments and deprecate ScheduleMoveToWorld

* Enhanced thread safety for m_WorldChangeInfo

* Return unique_ptr from cAtomicUniquePtr::exchange

* cWorld now calls entity cEntity::OnAddToWorld and cEntity::OnRemoveFromWorld.

Allows broadcasting entities added to the world from the world's tick thread.
This also factors out some common code from cEntity::DoMoveToWorld and cEntity::Initialize.

As a consequence, cEntity::Destroy(false) (i.e. Destroying the entity without broadcasting) is impossible.
This isn't used anywhere in Cuberite so it's now deprecated.

* Update entity position after removing it from the world.
Fixes broadcasts being sent to the wrong chunk.

* Fix style

* cEntity: Update LastSentPosition when sending spawn packet

* Add Wno-deprecated-declarations to the lua bindings

* Kill uses of ScheduleMoveToWorld
2020-03-05 12:52:34 +02:00
peterbell10
d7a726a423
Update LastSentPosition when entity has no speed (#4487)
* Update LastSentPosition when entity has no speed

* Restructure BroadcastMovementUpdate and always process relmove
2020-03-04 16:47:51 +02:00
Mat
aba329544f
Prevent container item duplication (#4476) 2020-03-04 15:12:15 +01:00
Mat
1ab87be80c
Play correct sound when entities are hit by arrows (#4481) 2020-03-04 02:05:04 +02:00
Mat
dca896dfcc Boats can be spawned on land 2020-03-01 13:27:19 +00:00
Mattes D
a0d2e934eb BlockTypePalette: Improved loading speed in MSVC Debug builds. 2020-02-24 09:37:40 +01:00
mathiascode
3d699c0dc4 Remove 1.13 from supported protocol list 2020-02-24 09:33:59 +01:00
Mat
6d938c0e3f
Blocks are usable in adventure mode (#4464) 2020-01-15 23:54:48 +02:00
Mattes D
4aef80b47e Added temporary block type mapping for 1.13+ protocols. 2020-01-07 06:53:17 +01:00
Mattes D
e234fbdafe StringUtils: Added note to StringsConcat about StringJoin. 2020-01-07 06:53:17 +01:00
Mattes D
583fd0a387 ProtocolRecognizer: Updated to unique_ptr. 2020-01-07 06:53:17 +01:00
Mattes D
b63bb2f694 Root: Load the UpgradeBlockTypePalette on startup. 2020-01-07 06:53:17 +01:00
Mattes D
208313dba1 main: Terminate if an exception is thrown. 2020-01-07 06:53:17 +01:00
Mat
dd665f092f
Clean up server folder for Android (#4448) 2020-01-02 17:59:07 +02:00
Alexander Harkness
bf10b56638 Fix android builds (#4432)
* Terminate android build script early if any step fails

* Remove deprecated android types

* Use android NDK cmake support rather than cmake android NDK support as that support is better supported

* Android uses GNU strerror_r?

* Fix compilation

* Rebase

* Fix final issues

* Drop submodule changes

* Revert change

* Parentheses

* Lower api levels

* Don't use GNU strerror_r for Android

Co-authored-by: Mat <mail@mathias.is>
2020-01-02 03:54:40 +02:00
Mat
fd3866154e
Include missing server files (#4446) 2019-12-30 19:05:19 +02:00
Mat
586a618640
Remove lang folder (#4445) 2019-12-30 16:02:11 +02:00
Mat
5074527d2c
Disable block placement in adventure mode (#4424) 2019-12-30 01:54:37 +02:00
Mattes D
2894ce3812 CMake: Fix builds in folders with spaces 2019-12-29 11:49:00 +01:00
Mattes D
5df6d4f535 CMake: Don't create symlinks if link == orig. 2019-12-28 23:26:54 +01:00
Mattes D
2d6f6a574d BlockTypePalette: Load from TSV or original reports' JSON. 2019-12-28 22:43:35 +01:00
Mattes D
7453a9fbe1 Moved ProtocolBlockTypePalette functionality into BlockTypePalette. 2019-12-28 22:43:35 +01:00
Mattes D
2de6b7537d BlockTypePalette: Refactored for usage in both directions.
Improves index() lookup speeds and allows BlockTypePalette to be used in place of ProtocolBlockTypePalette.
2019-12-28 22:43:35 +01:00
Mattes D
cc72b204b2
Output the binaries into a per-configuration Server subfolder. (#4440)
Make links to the original Server subfolder's items from the per-configuration Server subfolder.
2019-12-28 12:53:37 +01:00
Mat
f5af0e2e04
WebAdmin improvements (#4433)
* WebAdmin improvements

* Remove stray div tag

* Revert path change

* Remove buildserver link

* Further simplification

* Reduce horizontal padding

* Add svg icons

* Remove unneeded css

* Make login and logout icons colored

* Use same capitalization for Log in and Log  out

* Remove leftover code from old Webadmin design

* Remove more leftover code from earlier Webadmin versions

* and don't add earlier leftovers back...

* PR test

* Fix max width overflow

* Add missing css changes
2019-12-28 02:15:12 +02:00
NiLSPACE
dc787e1d96 Improved large jungle and acacia tree generation (#4413) 2019-12-22 23:38:11 +01:00
Peter Bell
fb2ef33c89 Correct block transparencies 2019-12-05 15:26:47 +01:00
Mattes D
61904af626 Moved growing from cWorld / cChunk to cBlockHandler descendants. 2019-10-28 10:45:43 +01:00
Mattes D
221cc4ec5c
Refactored block-to-pickup conversion. (#4417) 2019-10-16 10:06:34 +02:00
NiLSPACE
241d97bbf9
Fixed crash in hopper while pulling items from blockentity above itself (#4412) 2019-10-04 15:50:47 +02:00
Lukas Pioch
7b603f3c95 Added another check if the item is place able (#4404) 2019-10-03 12:34:15 +02:00
Mattes D
365cbc6e1c
Refactored more of Entities and BlockEntities to use Vector3. (#4403) 2019-09-29 14:59:24 +02:00
Lukas Pioch
ba664340f3 Cactus can now grow and will be dropped if there is no place to grow. 2019-09-29 13:42:29 +02:00
Mattes D
180a43d097 Fixed MSVC warnings (#4400) 2019-09-27 16:51:44 +01:00
Bond-009
eda2fc42d9 Fix clang8.0 build (#4399)
The protocol 13.0 PR broke clang 8.0 builds.
2019-09-24 20:38:54 +01:00
Mattes D
66e73a2d68 NBTChunkSerializer: Cleaned up interface.
Removed dependency on cChunkDataCallback.
Moved all the serializing code into a worker class.
Changed the serialization into a single-call action.
2019-09-24 17:38:59 +02:00
E14
d1c95742dd Add ProtocolBlockTypePalette (#4391) 2019-09-22 22:57:54 +02:00
Lukas Pioch
70d0b46b60 Added missing closing } in message output 2019-09-20 14:33:53 +01:00
Mattes D
c7132a3091 Protocol 1.9: Alpha-sort, add useful debugging code. 2019-09-16 15:37:54 +02:00
Tiger Wang
77731f80fb Initial support for 1.13 clients
+ Can look at *shape* of world
+ Can look at *shape* of inventory
2019-09-16 15:37:54 +02:00
E14
83013d19ca GCC: Added pragma to ignore fallthrough warnings within Unicode Inc. code (#4392) 2019-09-13 15:56:56 +02:00
Mattes D
3bc0f07fea Fixed warnings in ChunkDataSerializer. 2019-09-10 09:45:28 +02:00
Mattes D
2c804dd34a Protocol: Use logical outgoing packet types. 2019-09-10 09:45:28 +02:00
Mattes D
ad24702b4e ChunkGenerator: Changed to use cChunkCoords. 2019-09-08 20:21:49 +02:00
Mattes D
5f4df3e87d ShapeGen, HeiGen: Changed to use cChunkCoords. 2019-09-08 20:21:49 +02:00
Mattes D
e4ac84a6ab BiomeGen: Changed to use cChunkCoords params. 2019-09-08 20:21:49 +02:00
Mattes D
343bc2729e Generator: Added repeatability test. 2019-09-07 13:38:07 +02:00
Mattes D
f50c6735f8 CompoGenNether: Fixed different data produced in Linux Release builds. 2019-09-07 13:38:07 +02:00
Mattes D
d8d1e6e1d2 Added a BasicGeneratorTest. 2019-09-06 16:12:33 +02:00
Mattes D
878393a03d Moved the generator defaults to ComposableGenerator. 2019-09-06 16:12:33 +02:00
Mattes D
a2ffa432b3 Separated chunk generator from world / plugin interfaces.
The generator now only takes care of servicing synchronous "GetChunk(X, Y)" and "GetBiomes(X, Y)" requests.
2019-09-06 16:12:33 +02:00
Mattes D
f021e2fe22 Updated LibEvent to release 2.1.11-stable. (#4383)
This finally restores my ability to compile on Windows and Linux from the same source folder (on a network drive).

LibEvent broke this long ago by writing a config file into the source folder, rather than build folder. Now it's finally fixed.
2019-09-04 22:34:54 +01:00
Mattes D
2504538a3a
Added a basic PalettedBlockArea implementation (#4377) 2019-08-28 08:29:02 +02:00
Mattes D
74579fbadf
Improved testing framework. (#4376) 2019-08-26 21:38:34 +02:00
Mattes D
02fbf16865 Added BlockState implementation for 1.13 support. 2019-08-24 12:03:38 +02:00
Julius Oeftiger
9a1ed26893 Fix mobs targeting dead players (#4344)
Fixes #4340
2019-08-16 11:10:47 +01:00
Bond-009
e0ca4d8399 Fix building with clang 8.0 (#4346) 2019-08-11 10:39:43 +01:00
Bond-009
4de232bdae Wake up redstone simulator on slot changes for blockentities (#4348)
Fix #1898
Fix #2194
Fix #3063
2019-08-11 00:11:57 +01:00
Lukas Pioch
528db6eea7 Added null check for position (#4366) 2019-08-11 00:32:22 +02:00
Mattes D
26d0605121
Improved CMake generator (#4365) 2019-08-10 13:15:51 +02:00
Mattes D
d0b095ad51 Added more clamping operations to cCuboid. 2019-08-10 12:25:06 +02:00
Mattes D
e7016b1525
Removed coord-based API from cCuboid. (#4362) 2019-08-09 03:13:15 +02:00
peterbell10
a2547bf1fe
cBoundingBox: Fix tolua warning (#4361)
tolua was warning about no support for `operator =`.
Ref: #4360
2019-08-08 19:49:00 +01:00
Aplaus228
466d986e5e Change TakeDamageInfo::FinalDamage from int to float (#4359)
Closes #4357
2019-08-08 11:51:38 +01:00
Mattes D
f0cd34357e Fixed compilation on VS2019 2019-08-06 10:13:18 +02:00
Mattes D
8212f163b5 Register vanilla blocks in BlockTypeRegistry. 2019-08-05 21:42:54 +02:00
Mattes D
f48ac9f0c3 BlockTypeRegistry: Added hint manipulation 2019-08-05 21:42:54 +02:00
Mattes D
3722a239bf BlockTypeRegistry: Initial skeleton 2019-08-05 21:42:54 +02:00
Mark Asp
c00b365617 Check for nil in cWorld:SpawnSplitExperienceOrbs binding (#4354)
Adds explicit nil check for 'position' parameter to prevent crashes if invalid.

Fixes #4352
2019-07-28 14:09:51 +01:00
peterbell10
9dc1343bda
Ignore whitespace only lines in brewing and furnace recipes (#4332) 2019-06-11 13:39:44 +01:00
DaPorkchop_
52e6543ba5 Respect return value of cLuaWindow's OnClicked handler (#4322) 2019-06-11 12:07:35 +02:00
Wilhem Barbier
85006d10f5 Fix directory traversal bug (#4341)
Refuse to serve an URL containing `../`.
2019-06-11 10:33:56 +02:00
Zach DeCook
31a8d017d9 * Sponge: Add water absorbtion (#4333)
Closes #1411
2019-06-11 00:28:02 +01:00
Zach DeCook
24a8456f79 Create Ender Portal with Eyes of Ender (#4126)
The algorithm was designed so All portals must be facing the center, no matter which block had the eye inserted in last.

Note: Still need to create a block entity so that portals don't become invisible when you relog.

Addresses part of #3445
Fixes #3695
2019-05-11 20:43:26 +01:00
Zach DeCook
b9e7505d7f Buckets: Be able to place fluids through other fluids. (#4331) 2019-05-07 20:15:58 +01:00
DaPorkchop_
8b4d37771f Fix player skin sending through BungeeCord (#4328)
This fixes sending of player skins through BungeeCord by actually parsing the JSON instead of setting the player properties as a string.
2019-04-22 18:54:22 +01:00
DaPorkchop_
10b60971f5 Make Nether portals spawn the player inside of them (#4325)
Currently the player is spawned immediately in front of them.

Simply changing `cNetherPortalScanner::OutOffset` to 0.5 wasn't enough, as the player would always be spawned on top of the portal, however checking for non-solid blocks instead of air fixes this.
2019-04-18 14:54:55 +01:00
peterbell10
7d512f2191 Limit the size of cListAllocationPool's free list 2019-02-20 09:07:44 +00:00
Bond-009
2010a2b700 Add colors to console for macOS (#4303) 2018-10-15 17:03:08 +01:00
peterbell10
4727ed2084 Add a formatting function for Vector3 (#4282)
* Vector3: Add custom fmt compatible formatter.

* cLuaState: Add fmt version of ApiParamError

* Use vector formatting in manual bindings

* Always log vectors with FLOG
2018-09-24 21:33:39 +01:00
Muhammad Kaisar Arkhan
73689024f0 Add BurnsInDaylight to Lua API and Monsters.ini (#4295)
* Monster.h: Export SetBurnsInDaylight

This commit also adds BurnsInDaylight to check if the Monster burns in daylight
or not.

Closes https://github.com/cuberite/cuberite/issues/4294

* MonsterConfig.cpp: Add BurnsInDaylight

Closes https://github.com/cuberite/cuberite/issues/4294
2018-09-24 21:32:47 +01:00
peterbell10
ee84197014
Force all headers other than "Globals.h" to be included with relative paths (#4269)
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.
2018-08-29 01:51:25 +01:00
Alexander Harkness
c4f43cd8ec
Store and pass entity effect duration as an int not a short. (#4293)
Fixes #4292.
2018-08-26 15:52:39 +01:00
Rick van Schijndel
a1e52cb6d6 Fixes bed item 26 and 355 being spawned, only 355 spawns now (#4290) 2018-08-23 16:28:41 +01:00
changyong guo
89017dfbbc solve new player login crash issue (#4285)
currently if new player login, server will crash during send player ability to client.
this pull request solve this issue.
2018-08-17 16:46:06 +01:00
Nate
e7b552603f Handle the lapis slot separately (#4286)
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.
2018-08-17 09:08:06 +01:00
Nate
801d5d7170 Fix: Create players folder recursively (#4283)
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
2018-08-12 23:47:38 +01:00
changyong guo
57690b81a2 Experience orb (#4259)
* 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
2018-08-02 15:59:10 +01:00
peterbell10
1e014a54dc
Ocelots no longer multiply exponentially (#4272)
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.
2018-07-30 12:49:46 +01:00
bionext03
90d552a702 Add new flow direction calculating algorithm (#4160) 2018-07-27 10:01:53 +01:00
peterbell10
cdd8e42587
cWorld: Manually bind deprecated broadcast functions (#4265)
Ref: https://github.com/cuberite/cuberite/pull/4264#discussion_r204769193
2018-07-27 00:12:41 +01:00
peterbell10
950aeffff8
CheckBasicStyle: Check number of empty lines between functions (#4267)
Add check for number of empty lines between functions and fix the corresponding failures
2018-07-26 22:24:36 +01:00
Tiger Wang
b8ab03bc6b At long last... Piston animations!
* Fixes #3198
* Fixes #57 (again lol)
2018-07-25 15:29:53 +01:00
Tiger Wang
74f5160332 Reimplemented fall particles
Regression when 1.9.x support introduced in #3135, originally implemented in #461.
2018-07-25 15:29:26 +01:00
peterbell10
c94d7184eb Broadcast refactor (#4264)
* 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
2018-07-24 22:30:49 +01:00
peterbell10
b5f29d5d2c Stop cFunctionRef constructor from disabling default copy constructor. (#4173)
* Stop cFunctionRef constructor from disabling default copy constructor.
+ cFunctionRef: Improve documentation
2018-07-24 22:30:05 +01:00
peterbell10
31a11a6df4
Optimise chunk set (#4260)
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
2018-07-23 19:12:51 +01:00
peterbell10
e27290f7d2
cPawn: Reset last ground height in ResetPosition (#4261)
Prevents fall damage after teleporting/portaling to a lower height.

Fixes #3457
2018-07-23 17:26:48 +01:00
changyong guo
01e72ddb65 Rewrite explosion knock back (#4251)
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
2018-07-23 10:24:00 +01:00
changyong guo
7b0db672d1 Keep players in gmNotSet (#4248)
This allows players game mode to update to the default after portal to another world.
Fixes #4207
2018-07-23 00:35:32 +01:00
changyong guo
3e802932a6 recover hotbar selected slot after reconnect (#4249)
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
2018-07-22 23:23:33 +01:00
peterbell10
7b431bed51
cIsThread: Reset m_ShouldTerminate after the thread has stopped (#4258)
This allows threads to be restarted after stopping.

Fixes #4257
2018-07-22 22:35:58 +01:00
peterbell10
4fbf04413d
Make offline UUIDs consistent with vanilla. (#4178)
Fixes #4177

This is a breaking change to existing Cuberite permissions settings.
2018-07-20 00:30:09 +01:00
peterbell10
211cec621e
cBlockArea: Write all present data types by default (#4252)
cBlockArea::Write now defaults to use GetDataTypes() instead of assuming all data types are present.
Fixes cuberite/WorldEdit#130
2018-07-19 22:36:46 +01:00
Bond-009
2431b077cd Add unbreaking for armor (#4220)
Ref: minecraft.gamepedia.com/Enchanting#Unbreaking

#915
2018-07-12 23:10:15 +01:00
changyong guo
06eb5cc70d fix dispenser pickup display bug (#4247)
fix dispenser pickup bug by ignore meta data during pickup creation
2018-06-30 22:37:10 +01:00
changyong guo
be1f06520c fix block area rotation bug (#4243)
fix mirror method bug in class cBlockArea.
2018-06-25 18:31:05 +02:00
Alexander Harkness
03c977a200 Update m_IsSolid assignments in BlockInfo (#4167)
Fixes #4166
2018-06-24 11:32:17 +01:00
changyong guo
2d3013d1d3 Support swap item between main hand and offhand by press key "F" (#4241)
Hi,

I found cuberite don't support to press key "F" to swap items on main hand and offhand, so I implemented this feature.

Best regards
Changyong
2018-06-24 10:24:10 +01:00
peterbell10
24603a7640 Flush stdout after resetting console colour. (#4240) 2018-06-20 09:15:57 +02:00
Bond-009
b9fdaf8a94 Use clang-tidy to check more code conventions (#4214)
* Create clang-tidy.sh
* Add clang-tidy to circle.yml
* Fixed some naming violations

Fixes #4164
2018-05-06 18:07:34 +01:00
Cocosushi6
fbf5cf7aa6 Generate cacti and sugarcane with different heights (#4137)
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
2018-05-03 19:25:08 +01:00
peterbell10
a4dbb5c582
Prefer static_cast to reinterpret_cast (#4223)
* 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.
2018-05-02 08:50:36 +01:00
peterbell10
86a8fdf3fe tolua++ bindings use nullptr. (#4219)
Fixes compilation with -Wzero-as-null-pointer-constant.
2018-04-27 23:22:41 +02:00
peterbell10
319b30eec6
Fix fishing timer (#4217)
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.
2018-04-27 16:33:45 +01:00
mathiascode
02d75c5336 Removed unnecessary disconnect (#4200) 2018-04-27 08:59:03 +02:00
Bond-009
98d807187b Removed duplicate code (#4198)
Should also fix dogs not despawning
2018-04-11 12:17:30 +01:00
peterbell10
4bf160d596 Update m_LastSentPosition in TeleportToCoords and DoMoveToWorld. (#4211) 2018-04-11 08:39:24 +01:00
Alex Sweet
a0896c63d7 Smelting Gives Experience (#4094)
* 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
2018-04-11 07:46:11 +01:00
peterbell10
1e312296cc Fix cUUID::Variant (#4213) 2018-04-08 00:20:53 +02:00
mathiascode
f4a1ebd880 Properly destroy player (#4199) 2018-04-03 14:39:39 +01:00
Zach DeCook
7833e8112f * Block Info: glazed terracotta and concrete hardness/solid voxel status (#4205) 2018-04-02 18:45:01 +01:00
mathiascode
a879778968 Broadcast playerlist removal in every world (#4201) 2018-04-02 18:39:54 +01:00
Bond-009
1991a5b0e6 Wolves only spawn in taiga biomes (#4197)
Ref: https://minecraft.gamepedia.com/Wolf#Spawning
2018-03-20 10:44:30 +01:00
peterbell10
4f26f653e1
Add cPluginManager::GenericCallHook (#4027)
Replace repetitive CallHook functions with a generic implementation.
Also converts some loops to range-based for.

Related to #1134
2018-03-02 10:40:48 +00:00
peterbell10
999faa9d90
cLightingThread: Faster chunk reading (#4185)
Profiled at a 10x speedup for cLightingThread::ReadChunks.
2018-02-21 10:30:48 +00:00
peterbell10
1ea36298d2
Fix cUrlClient leak (#4125)
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.
2018-02-20 17:08:46 +00:00
peterbell10
cf75d7b2c5 cBlockInfo: Deprecate direct access to variables. (#4184) 2018-02-20 10:43:28 +00:00
Bond-009
7e9695ecb0 Damage fishing rod when catching the hook on a block, then reeling it in (#4151)
Fixes #4132
2018-02-11 12:40:16 +00:00
peterbell10
d3c1c626f5
Deal with covered switches consistently (#4161)
* 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()
2018-02-04 23:07:12 +00:00
peterbell10
2df14a0496
cChunk and cChunkData: Use vectors for block get and set functions (#4172)
* cChunkData: Change interface to use Vector3i
* cChunk: Add Vector3i overloads for bounded block get and set functions.
2018-02-04 22:15:31 +00:00
Bond-009
d12804d4c0 Ocelots don't take fall damage (#4171) 2018-02-04 20:53:35 +00:00
peterbell10
f0c735e846
A player's inventory is always opened by its owner. (#4176)
Fixes #4093

Window updates are only broadcast to players in the m_OpenedBy list. Normally players are added after sending a window open packet but no packet is sent for a player's inventory. This meant broadcasts were never sent for the inventory window.
2018-01-28 17:24:59 +00:00
peterbell10
95108c134d
cClientHandle: Always call HOOK_PLAYER_RIGHT_CLICK (#4149)
Reverts the reduction in cases where the hook was called, a change which broke plugins.
2018-01-25 08:10:16 +00:00
Bond-009
d3a3c6ad2c Removed cBlockInfo.m_IsSnowable (#4105)
* Removed cBlockInfo.m_IsSnowable

* Return IsSnowable from deprecated variable binding m_IsSnowable.
2018-01-23 21:07:06 +00:00
peterbell10
ab350d1e43
cItemGrid: Allocate storage lazily (#4083)
* cItemGrid: Allocate storage lazily
* cItemGrid: Fix spelling, Prioritary -> Priority
2018-01-21 18:45:13 +00:00
peterbell10
e88b3fa2fe New movement system for leashed entities (#4147)
* New movement system for leashed entities
Entities are accelerated towards the leashed to entity as if by a spring.
 * Mobs now pathfind close to but not directly to the leashing entity.
* Also minor comment changes
2018-01-17 21:40:58 +00:00
Bond-009
ec9e0eecf6 Calculate crit damage properly (#4154) 2018-01-17 21:12:24 +00:00
Bond-009
701fee334c Prioritize hinge on the left side (#4153) 2018-01-17 19:15:42 +00:00
Bond-009
d11335e4f6 Add world name in logs from cWorld (#4148) 2018-01-16 22:04:39 +00:00
Alexander Harkness
07619d932d
Exp Orbs and Pickups are destroyed instantly by cacti. (#4136)
* Cactus detection code follows pattern set in #3996

* Pickups are now destroyed on cactus contact

* Add cactus detection and destruction to Exp Orbs

Remove checks for IsExpOrb() in cEntity::Tick()

Exp Orbs do not call super::Tick() and so this condition was
pointless.
2018-01-16 19:13:17 +00:00
Bond-009
3065a101a5 Don't burn mobs in daylight when swimming (#4145) 2018-01-15 22:44:48 +00:00
peterbell10
a72891fbb0
cWindow: Fix slot area priority when double click stacking. (#4086)
Fixes #4084
2018-01-15 11:35:27 +00:00
Alexander Harkness
ad22922393 Rename cEntity swim states (#3996)
* Replace cEntity:m_IsSubmerged with m_IsHeadInWater
* Replace cEntity:m_IsSwimming with m_IsInWater
* Add API documentation for new symbols
* Apply SetSwimState to all entities, not just mobs and players
* Pickups now use IsOnFire to check if they are on fire before destruction

Fixes #3987
2018-01-14 18:44:45 +00:00
9caihezi
4242431407 Rewrite cClientHandle::HandleRightClick (#4089)
* 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.
2018-01-08 13:37:10 +00:00
Alexander Harkness
2529a89835 Golden Apple Fixes (#4130)
* Do not remove food item until player has been fed
* Golden apples now ignore hunger when eating
* Removed EnchantedGoldenApple recipe, as it was removed in 1.9
    Reference: https://minecraft.gamepedia.com/1.9#Items_2
* Adjust golden apple effects, as they were changed in 1.9
    Reference: https://minecraft.gamepedia.com/1.9#Items_2
2018-01-06 00:39:23 +00:00
Bond-009
d7de2dccf0 Improved fishing rewards (#4120)
* Damage fishing rod after use
* Give xp to the player for catching something
* Fixed junk drops
* Implement Luck of the Sea
2018-01-05 14:32:30 +00:00
Bond-009
a2de7c2bb1 Sugar cane can be near frosted ice (#4133) 2018-01-05 12:49:08 +00:00
Alexander Harkness
b4aa19f329
Item durability loss now depends on the item used. (#4123)
Armour durability also no longer changes when it
is used to break blocks or attack mobs.

Fixes #4119
2018-01-05 11:28:06 +00:00
peterbell10
757231cc6e
Add the fmt library (#4065)
* 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.
2018-01-03 17:41:16 +00:00
Zach DeCook
68fc28857f Concrete mixing (#4096)
Adds a block handler for concrete powder and implements hardening to concrete.
Concrete powder turns into concrete when:
* It is next to water when it receives a block update
* It falls onto a water block (even with Physics SandInstantFall=1)
2018-01-03 16:33:31 +00:00
peterbell10
177273006e
cLuaState: Update Push for entities. (#4128)
Fixes #4127

Some classes were exported but were only pushed as a cEntity
meaning exported functions were inaccessible.
This brings cLuaState::Push(cEntity *) up to date with all exported entities.
2018-01-03 11:38:00 +00:00
Bond-009
00da9006b7 Lilypads can be on top of (frosted) ice (#4122)
Fixes #4117
2017-12-27 18:47:28 +00:00
Alexander Harkness
6309c6a97f
improve rain simulation (#4017)
* Uses vanilla logic to decide which blocks rain falls through.
 * Rain falls infinitely above the world, and stops at y=0.
 * Entities will now be extinguished if they are under rain-blocking
blocks, and fire will now be extinguished by rain similarly.
 * Create IsWeatherWetAtXYZ to identify wetness at a particular location. 
 * Use new code for enderman rain detection.
 * Fixes issue #916
 * Disable warnings for global constructors in the fire simulator.
2017-12-26 21:25:57 +00:00
Alexander Harkness
705deea205
Water bottles are drinkable potions (#4114)
Water bottles are now drinkable potions

Fixes #4111

Also update outdated mcwiki references
2017-12-26 20:27:24 +00:00
peterbell10
533c95d9e2 Protocol: Fix potion metadata parsing (#4116) 2017-12-26 18:51:38 +00:00
peterbell10
832b394715 Fix Travis build (#4101)
Stop using gdb on osx - was breaking the build
Add clang 3.5 build as travis now defaults to 5.0
Fix unknown-warning-option errors on AppleClang
ProtoProxy: Use nullptr
UrlClientTest: add override to callback destructor
Update jsoncpp to use nullptr
2017-12-22 18:25:46 +00:00
Alexander Lyons Harkness
a9c8ad9ce2 Fix typo in #4095.
The build was being broken.
2017-12-21 16:01:24 +00:00
Mattes D
01322cb1b0 NetworkLookup: Added "virtual" keyword to overridden dtor. (#4100) 2017-12-21 13:31:20 +00:00
peterbell10
e0ff5f5639 cInventory: Add listener to shield slot. (#4095) 2017-12-21 11:55:23 +00:00
bibo38
532731e6f4 Fixed Clang 5.0 compile errors (#4085)
* Fixed Clang 5.0 compile errors

* Fixed wrong comment

* Only disable warnings in Clang 5 or higher

* Added a CMake condition for the Clang 5 no-zero-as-null-pointer-constant warning

* Now using the use_nullptr branch of the Cuberite specific SQLiteCpp fork
2017-12-21 11:36:58 +00:00
Fabian
0dd172b80f Store Health as a float (#4073)
* Fix #4024

* Fix clang error

* Add comment

* Fix behaviour

* Save Health as float

* Changed m_Health to float

* Remove redundant static_cast

* Fix casts
2017-11-22 13:47:52 +00:00
peterbell10
ef091fe24b cBlockRail: Fix assertion failure (#4075) 2017-11-21 21:54:21 +00:00
Bond-009
5badb9bcca cChunkInterface GetBlock, GetBlockMeta, GetBlockTypeMeta use vectors (#4050) 2017-11-20 11:13:11 +00:00
peterbell10
bf5e6874fe cItemHandler: Update max stack size of old doors. (#4072) 2017-11-20 11:04:17 +00:00
peterbell10
c54bf40ef9 cWorld Threads: Seperate initialization and thread start.
Prevents nullptr dereferences before Start has been called.
2017-10-21 19:33:22 +02:00
peterbell10
1537ebed6f cWorld: Move Initialization from Start to the constructor.
Start now does nothing more than launch the world's threads.
2017-10-21 19:33:22 +02: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
Bond-009
e585595ae6 Fixed some small passive mob issues (#4057)
* Chickens can be bred with seeds, beetroot seeds, melon seeds, or pumpkin seeds Ref: https://minecraft.gamepedia.com/Chicken#Baby_chicken
* Baby passive mobs don't drop items
* Fixed the size of some mobs
2017-10-21 17:55:46 +01:00
peterbell10
744cdb726d Fix minecart deceleration (#4059) 2017-10-21 17:53:24 +01:00
Bond-009
05e7be7f73 Fixed FreeBSD build (#4061) 2017-10-16 18:39:53 +01:00
Bond-009
76a0971279 Fixed 2 small warnings (#4055) 2017-10-02 20:59:25 +01:00
peterbell10
8866a28cf8 Fix explosion interaction with block entities. (#4052)
* WriteBlockArea: Fix erasing of block entities.

* cChunkMap::DoExplosionAt destroys block entities
2017-09-27 22:22:15 +01:00
peterbell10
4b14a5b4c1 cPressurePlateHandler: Fix uninitialised variables. (#4047) 2017-09-25 21:41:11 +01:00
Bond-009
10c5c1227e BroadcastBlockBreakAnimation and BroadcastBlockEntity use vectors (#4038) 2017-09-25 18:17:45 +02:00
peterbell10
463fa48aec cBlockArea: Fix performance regression (#4045) 2017-09-23 17:47:46 +01:00
peterbell10
e883aa828c Add support for release 1.12.2 (#4041) 2017-09-21 14:12:43 +01:00
peterbell10
15fd4ef829 Only allow snow to be placed where valid. Fixes #2920. 2017-09-21 13:01:00 +01:00
peterbell10
ab4f0df5b9 Only allow rails to be placed where valid.
Fixes #3507.
2017-09-21 13:01:00 +01:00
Lukas Pioch
da11d94933 Added working directory for x64 builds (#4037) 2017-09-20 19:01:46 +01:00
Mattes D
e0d1f791a3 Fixed webadmin certificate reading. 2017-09-19 19:44:30 +02:00
Lane Kolbly
30c8470a52 Changed BroadcastSoundEffect, SendSoundEffect, and CastThunderbolt parameters to vectors (#3959)
* Made BroadcastSoundEffect take vector parameters.

* Added docs for new vectored methods

* Removed old code

* Fixed lua warnings

* Made old BroadcastSoundEffect not an override.

* m_Block to m_BlockPos, used Vector3d constructor where prettier.

* a_Block to a_BlockPos

* Changed thunderbolt a_Block to a_BlockPos
2017-09-19 15:12:54 +01:00
peterbell10
8835bf344d cRoot: Make PollPeriod representation 32 bit (#4030) 2017-09-19 14:14:44 +01:00
Bond-009
491e91dc88 Leaves now drop with the correct meta when broken by a pickaxe with silk touch (#4034) 2017-09-19 09:44:21 +01:00
Lukas Pioch
c5f590d460 Removed UTF-8 BOM (#4033) 2017-09-19 10:34:08 +02:00
peterbell10
b5fa96f4f8 cFinishGenPreSimulator: Preserve sand meta (#4025)
Fixes #1516.
2017-09-18 08:45:32 +01:00
Alexander Harkness
0968a4d360 Fix error with implicit cast from long long to long (#4026) 2017-09-14 13:11:22 +02:00
peterbell10
307e7aaff5 Fix switch warnings (#4013)
* 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
2017-09-14 09:48:57 +01:00
Alexander Harkness
a4c07d2f98 Adjust lava damage values (#4020)
Fixes isue #2925
2017-09-12 09:02:17 +01:00
peterbell10
3ec9e6ec87 Limit how long cRoot::InputThread may block (#4019)
Limit how long cRoot::InputThread may block
Only calls `std::getline` when there is input available
which removes the need to "notify" the input thread.
Fixes #2494 and fixes #3177
2017-09-12 07:41:39 +01:00