1
0
Fork 0
Commit Graph

971 Commits

Author SHA1 Message Date
peterbell10 13144a08e4
Enable some more clang-tidy linter checks (#4738)
* 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
2020-05-14 22:15:35 +00:00
peterbell10 154df6b09d
Cleanup unneeded globals (#4736) 2020-05-10 16:16:38 +00:00
peterbell10 e6634ed26c
Update submodules (#4727)
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.
2020-05-09 15:51:15 +01:00
mBornand 1565d9b3ce
Use Vector3 for cLineBlockTracer and cBlockTracer (#4715)
* cLineBlockTracer uses Vector
2020-05-08 10:04:07 +01:00
Mat c710f6a4ea
Remove old Android leftovers (#4722) 2020-05-07 22:14:00 +03:00
Mattes D bdb8830b9c Fixed various MSVC warnings. 2020-05-06 12:53:37 +01:00
Alexander Harkness 4e4ef9052e
Refactor minecart collision detection code. (#4712)
* Refactor minecart collision detection code.

 - Use new GetBoundingBox function.
 - Handle descending and ascending rails.
 - Snap to descending rails.

* Add message for UNREACHABLE
2020-05-04 21:04:21 +00:00
Alexander Harkness 8240894d07
Add comment for boat position broadcast 2020-05-04 09:13:55 +01:00
Tiger Wang 07ca095740
Improve entity position updates (#4701)
* 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
2020-05-04 08:10:47 +00:00
DrButcher 258318ab98
Buttons can now be triggered by arrows. (#4670)
* Buttons can now be triggered by arrows.
2020-05-03 21:05:32 +01:00
Alexander Harkness 994036a3b8
Add cEntity::GetBoundingBox, and use where appropriate. (#4711)
* Add cEntity::GetBoundingBox, and use where appropriate.
2020-05-03 21:04:33 +01:00
mathiascode 5f2c572f9a Set entity world early 2020-05-03 11:49:00 +01:00
Tiger Wang 0b9b7bc1a8 Unify entity spawn packet sending 2020-04-30 23:04:56 +01:00
Mattes D 487f9a2aa9
Vector3 in Handlers (#4680)
Refactored all cBlockHandler and cItemHandler descendants to use Vector3.
2020-04-21 22:19:22 +02:00
Tiger Wang 246acb19f9 Delet SpawnObject params
* Fix #4679

awkward...
2020-04-19 23:29:52 +01:00
Tiger Wang 9d124e6b0a More arrow patches
* Further reduce instances of appearing black
* Fix packet send and get arrows to more reliably lodge in blocks clientside
* Fix hit detection failing at chunk boundaries
+ Use delegating constructors
2020-04-19 20:08:24 +01:00
Tiger Wang 2976cec4c0 Reduce arrows going black on hit 2020-04-18 20:06:35 +00:00
Tiger Wang 50893667db MoveToWorld must always be provided a world 2020-04-18 19:51:30 +01:00
Tiger Wang e98f93a079 Only store IDs across ticks 2020-04-18 19:51:30 +01:00
Mattes D 9ee47e5999 Using Super. 2020-04-16 20:07:48 +00:00
Mattes D fb05ea7cf7 Fixed entity teleport for just-spawned entities.
Includes a test code in the Debuggers plugin - throwing a cake-as-fallingblock.
2020-04-12 13:34:24 +02:00
Bond-009 8438def87e
Add Zombie Villagers 2020-04-10 00:50:45 +01:00
Mat d966a12624
Don't set entity world twice (#4606)
* Don't set entity world twice

* Call HookSpawnedEntity when the entity actually spawned
2020-04-09 20:26:06 +00:00
Mattes D bdedab15c9
Falling blocks can now be spawned at any position. (#4620)
* Falling blocks can now be spawned at any position.

* Added a /cake command to Debuggers that throws a cake in a nice slow arc.

* Fixed regular falling blocks.
2020-04-09 20:25:20 +00:00
Mat 4ed182c13a
Tweak pickup sound pitch (#4598) 2020-04-03 15:49:12 +00:00
Mattes D 01b8ed5295
Pulled the BlockID and BlockInfo headers from Globals.h. (#4591)
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
2020-04-03 08:57:01 +02:00
Alexander Harkness cdc452916e
Replace buckets to the selected hotbar slot, rather than the first available. (#4580)
* Replace buckets to the selected hotbar slot, rather than the first available.

Replicates vanilla behaviour, as well as being more logical.

* Refactor cInventory::AddItem. Behaviour is now documented

* Add new cInventory::ReplaceOneEquippedItem and ::SetEquippedItem methods

* Return empty potion to the same slot after drinking

* Replace buckets correctly in other situations, not simply water and lava

Uses the new ReplaceOneEquippedItem method

* Correct collecting water from source block with bottle

* Add cPlayer::ReplaceOneEquippedItemTossRest method

* Handle stacked filled buckets (in theory)

Use new cPlayer::ReplaceOneEquippedItemTossRest method
2020-04-02 12:42:15 +00:00
peterbell10 59e38d1a46
Fix explosion knockback issues and tweak knockback strength (#4590) 2020-04-02 09:29:42 +02:00
Alexander Harkness 9210501af5
Prevent player from being destroyed by plugins (#4584)
* Prevent player from being destroyed by plugins

Add manual binding, bails out with error message if attempted
entity to destroy is player.

* Improve warnings and documentation, remove automatic binding

* Remove old and unnecessary deprecated function
2020-03-31 11:39:23 +00:00
Mat 5eb1ba3bcc
Lua API for spectating entities (#4518) 2020-03-30 21:35:37 +02:00
Mat f5beeccd25
Fix typo in floater code (#4556) 2020-03-27 02:40:40 +02:00
Mat 782619e3f8
Send respawn packet by default (#4540) 2020-03-24 14:54:12 +00:00
Alexander Harkness 0a68994f48 Manual merge of #4498.
Credit to @MeMuXin

Closes #4498
2020-03-23 12:18:12 +00:00
Mat 7700116330
Pickup spawn improvements (#4525)
Pickups are now thrown around when spawned, like in vanilla. Pickups also bail out of the collision detection checks while being created, to prevent them from blasting too far off in e.g. cobblestone generators.
2020-03-23 00:05:47 +00:00
Mat 0b0d6b23d2
Fix effect crashes (#4530)
* Fix effect crashes

* Change according to suggestion
2020-03-22 17:34:24 +02:00
Mat c968f1f7da
TNT position fixes (#4519)
* TNT position fixes

* Don't add offset to explosion spawn coords

* Don't make other entities push TNT

* Correct initial TNT speed

* Fix typo

* Improvements

* Revert unwanted change

* Style fixes

* Update format
2020-03-22 17:33:36 +02:00
Mat c750c4e55f
Fix armor protection (#4506)
* Fix armor protection

* Check min damage

* Check min damage

* Commit missing changes

* Convert to int

* Use float

* Float some more
2020-03-22 12:39:32 +02:00
Mat 49dd645aa6
Don't remove items twice (#4524)
* Don't remove items twice
2020-03-22 12:17:04 +02:00
stone3311 0a1cfda02c
Clamp teleportation position (#4203) 2020-03-20 09:31:06 +01:00
Mat 0e07e231a2
Improvements to knockback (#4504)
* Improvements to knockback
* SetSpeed for explosions
* Improve code consistency
2020-03-19 17:13:41 +00:00
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
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 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 1ab87be80c
Play correct sound when entities are hit by arrows (#4481) 2020-03-04 02:05:04 +02:00
Mattes D 61904af626 Moved growing from cWorld / cChunk to cBlockHandler descendants. 2019-10-28 10:45:43 +01:00
Mattes D 365cbc6e1c
Refactored more of Entities and BlockEntities to use Vector3. (#4403) 2019-09-29 14:59:24 +02:00