1
0
Commit Graph

960 Commits

Author SHA1 Message Date
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
Mattes D
180a43d097 Fixed MSVC warnings (#4400) 2019-09-27 16:51:44 +01: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
Aplaus228
466d986e5e Change TakeDamageInfo::FinalDamage from int to float (#4359)
Closes #4357
2019-08-08 11:51:38 +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
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
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
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
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
bionext03
90d552a702 Add new flow direction calculating algorithm (#4160) 2018-07-27 10:01:53 +01:00