Dylan K. Taylor
c77829f4ad
Migrate packet creation to use ::create() methods in all but one case
...
MovePlayerPacket doesn't yet have a ::create() due to a complication with fields that aren't always present.
2021-10-23 01:46:01 +01:00
Dylan K. Taylor
c773e43eda
Updated BedrockProtocol to pmmp/BedrockProtocol@97fa88e9ef
2021-10-23 01:16:45 +01:00
Dylan K. Taylor
aa53dc6709
Entity: fixed network properties not updating when fireTicks changes
...
another bug that LBSG knew about, but didn't report. :/
2021-10-09 23:57:37 +01:00
Dylan T
4111d92b98
Stop hardcoding chunk dimensions everywhere ( #4443 )
2021-09-10 16:13:25 +01:00
Dylan K. Taylor
931c3ed77d
Entity: fixed current movement not being accounted for in fall height
...
this caused incorrect damage when falling from heights, as well as a bug in #4434 .
2021-09-06 12:53:52 +01:00
Dylan K. Taylor
956780c6a6
Entity: add getters and setters for fallDistance
2021-09-05 23:59:04 +01:00
Dylan K. Taylor
ded778f422
Implemented bed bouncing
2021-09-05 20:11:49 +01:00
Dylan K. Taylor
d329bfb25d
Entity: rename movX/movY/movZ to wantedX/wantedY/wantedZ
...
this makes the code much easier to understand.
2021-09-05 14:06:53 +01:00
Dylan K. Taylor
73cc841d0b
Entity: rename checkBlockCollisions() to checkBlockIntersections()
2021-09-05 14:00:27 +01:00
Dylan K. Taylor
8be1f34736
Entity: Rename fall() to onHitGround(), and make it protected
...
this had no business being exposed to public API in the first place.
2021-09-05 13:36:40 +01:00
Dylan K. Taylor
6ecad153ea
Entity: remove fallDistance parameter from fall()
2021-09-05 13:34:43 +01:00
Dylan K. Taylor
7e82cafdeb
Entity: remove a bunch of commented code that no one cares about
2021-09-05 13:27:48 +01:00
marshall
6e68e99ec0
Added PlayerEntityInteractEvent ( #4374 )
2021-08-24 11:56:10 +01:00
Dylan K. Taylor
83805a3406
Entity: use match in checkObstruction()
2021-08-17 20:44:49 +01:00
Dylan K. Taylor
91d54ff0ad
Removed unnecessary and/or obsolete GC hacks
...
the intent of these hacks was to break cyclic references to avoid having objects lingering in memory. However, all of the stuff that's being removed in this commit no longer has any effect anyway, due to the fact that these things don't circularly reference each other anymore. Notably, Tile inventories now keep Position instead of a Tile ref.
2021-06-30 19:16:25 +01:00
Dylan K. Taylor
11b483f2dc
Inline EntityDataHelper::createBaseNBT()
...
this is only used for saving entity data now, and its presence here is allowing plugin devs to keep abusing it.
2021-06-19 18:45:21 +01:00
Dylan K. Taylor
5a14c1cb89
Entity: don't rebuild metadata every tick unless an associated property changed
...
this should improve performance back to PM3 levels.
2021-05-17 20:05:52 +01:00
Dylan K. Taylor
094c949e86
Entity: fixed extremely stupid bug with player respawning after ragequit
2021-05-11 19:08:56 +01:00
Dylan K. Taylor
652de2632a
Rough OffHand implementation
...
this doesn't do stuff like taking arrows from offhand yet.
2021-05-05 14:46:51 +01:00
Dylan K. Taylor
69cb0ba1bb
Entity: don't flag as closed until just before cycle destruction
...
this allows stuff that requires a non-cycle-destroyed state to still operate during onDispose().
2021-03-19 01:00:49 +00:00
Dylan K. Taylor
053a7a1a61
Entity: split getSyncedNetworkData() into two functions
...
to avoid opaque boolean parameters
2021-01-08 13:59:52 +00:00
Dylan K. Taylor
e53b57732b
Entity: replace separate height/width/eyeHeight fields with an EntitySizeInfo structure
...
this will make it easier to implement stuff like sleeping (properly), swimming and gliding without needing to duplicate all the fields.
2021-01-08 00:11:01 +00:00
Dylan K. Taylor
793081d803
Entity: assume that position has a valid World during setPosition()
2020-12-27 19:20:37 +00:00
Dylan K. Taylor
bcc3e87730
Timings: rename core timers to remove 'timer' from the names
...
this makes them shorter and more consistent.
2020-12-23 17:52:25 +00:00
Dylan K. Taylor
dd58a95ae5
Move last-known-position tracking to World instead of Entity
2020-12-10 18:28:40 +00:00
Dylan K. Taylor
e925423749
Entity: fix chunk tracking consistency issues, fixed attempted chunk loading in origin world when teleporting to a different position in a different world
2020-12-10 18:13:18 +00:00
Dylan K. Taylor
d728160a77
Removed the cycle between Entity and Chunk
...
it's now the World's responsibility to manage adding/removing entities from appropriate chunks. Entities no longer know or care that chunks exist.
Entity->checkChunks() remains as-is for backwards compatibility - now it just calls the world to sync its position.
2020-12-05 00:59:16 +00:00
Dylan K. Taylor
999defd20d
World: remove create params from loadChunk() and loadChunkAtPosition()
2020-12-03 18:49:14 +00:00
Dylan K. Taylor
1e7f9214cc
Entity: flag for despawn if entering ungenerated terrain
...
previously this created an empty chunk for the entity to hang around in until the terrain was generated, but that's problematic for several reasons, most importantly the fact that non-generated chunks are not saved.
2020-12-03 18:36:54 +00:00
Dylan K. Taylor
10067c1043
Improve painting performance
...
these really shouldn't hit the CPU at all considering they are simply static objects ...
2020-12-01 23:31:38 +00:00
Dylan K. Taylor
66955d4b99
World: make loadChunk() more useful, drop useless proxy function getOrLoadChunk()
2020-11-09 13:41:46 +00:00
Dylan K. Taylor
e6348bbd34
Entity: do not assume that save IDs are always strings
...
this is only the first of many changes needed to make entity savedata fully format-agnostic, but it's a start.
2020-11-06 13:05:17 +00:00
Dylan K. Taylor
5cc2a9c3dd
World: rename getChunkAtPosition() to getOrLoadChunkAtPosition()
...
this more accurately reflects what it does.
2020-11-03 14:12:47 +00:00
Dylan K. Taylor
8be0c0da0d
Implemented a silent property on entities and Entity->broadcastSound()
...
fixes #3516
2020-10-31 16:07:18 +00:00
Dylan K. Taylor
4c0c2ebd24
CS cleanup
2020-10-26 15:56:30 +00:00
Dylan K. Taylor
44e446b621
Merge remote-tracking branch 'origin/stable' into master
...
# Conflicts:
# build/php
# composer.lock
# phpstan.neon.dist
# resources/vanilla
# src/pocketmine/Server.php
# src/pocketmine/VersionInfo.php
# src/pocketmine/entity/Entity.php
# src/pocketmine/lang/locale
# src/utils/Timezone.php
# tests/phpstan/bootstrap.php
# tests/phpstan/configs/custom-leveldb.neon
2020-10-13 17:51:49 +01:00
Dylan K. Taylor
b0b08d45d5
Entity: clean up sendData() handling, remove send-to-self hack
2020-10-08 21:35:36 +01:00
Dylan K. Taylor
cbc6ebebad
Entity: make use of MoveActorAbsolutePacket::create()
2020-10-06 18:35:02 +01:00
Dylan K. Taylor
531c6344fe
Entity: stop using broadcastPacketToViewers for movement / motion
...
this is now effectively identical to sending packets to each of hasSpawned, with the exception that it won't send packets to itself if it's a player.
2020-10-06 18:22:46 +01:00
Dylan K. Taylor
75e3a0aa0f
Merge branch 'stable' into master
...
# Conflicts:
# composer.lock
# resources/vanilla
# src/command/defaults/StatusCommand.php
# src/pocketmine/entity/Entity.php
# src/pocketmine/level/format/SubChunk.php
2020-09-26 13:27:08 +01:00
Dylan K. Taylor
626680c6c1
Use new Location objects instead of mutating Entity->location directly
...
I'm actually not a big fan of needing to recreate the whole thing just to modify the coordinates. This seems kind of stupid.
2020-09-25 18:43:49 +01:00
Dylan K. Taylor
db7fb25196
Avoid more Vector3 mutations using withComponents()
2020-09-25 18:40:13 +01:00
Dylan K. Taylor
1d8e7abdd4
Entity: avoid direct mutation of Vector3 in checkObstruction(), use withComponents() instead
...
this ugly code can be simplified quite a lot further, but that's a job for later.
2020-09-25 18:38:41 +01:00
Dylan K. Taylor
25566c2f1a
Entity: avoid direct Vector3 mutations in tryChangeMovement()
2020-09-25 18:37:29 +01:00
Dylan K. Taylor
38b97dd0b7
Entity: remove useless function
2020-09-25 18:11:24 +01:00
Dylan K. Taylor
a5e21bfaa9
Entity: protect getBlocksAroundWithEntityInsideActions()
2020-09-25 16:40:30 +01:00
Dylan K. Taylor
3556f26e00
Entity: Rename getBlocksAround() -> getBlocksAroundWithEntityInsideActions()
...
this name is more long-winded, but much less misleading.
2020-09-25 16:39:55 +01:00
Dylan K. Taylor
8e12693494
Entity: Invalid blocksAround cache when something happens during onEntityInside()
...
this fixes TNT spawning multiple entities when lit by flaming arrows.
The problem here is a bit more complex (entities aren't immediately notified when local block updates happen, so they cache stuff that becomes unusable). The simplest option would be to just lose the cache, but that would have some impacts on performance.
Barring a rethink of the block updating mechanism, this solution seems usable for now.
2020-09-25 16:35:59 +01:00
Dylan K. Taylor
5096741b29
World::getChunk() behaviour now matches that of a regular ChunkManager
...
Various bugs existed for a while with stuff using chunk managers instead of worlds when interacting with terrain due to a behavioural inconsistency between World::getChunk() (return from cache or load from disk), and SimpleChunkManager::getChunk() (return from cache only). This change brings the two in line.
World::getOrLoadChunk() has been added as a replacement, which has the same behaviour as the old getChunk() and also makes it more obvious that there is an issue with code using it during refactoring.
2020-09-20 13:29:09 +01:00
Dylan K. Taylor
101dc1e1d7
fixed a couple of new phpstan errors
2020-09-04 01:44:21 +01:00