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
25566c2f1a
Entity: avoid direct Vector3 mutations in tryChangeMovement()
2020-09-25 18:37:29 +01:00
38b97dd0b7
Entity: remove useless function
2020-09-25 18:11:24 +01:00
a5e21bfaa9
Entity: protect getBlocksAroundWithEntityInsideActions()
2020-09-25 16:40:30 +01:00
3556f26e00
Entity: Rename getBlocksAround() -> getBlocksAroundWithEntityInsideActions()
...
this name is more long-winded, but much less misleading.
2020-09-25 16:39:55 +01:00
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
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
101dc1e1d7
fixed a couple of new phpstan errors
2020-09-04 01:44:21 +01:00
0aee39027e
Merge branch 'stable' into master
...
# Conflicts:
# composer.lock
# resources/vanilla
# src/entity/Living.php
# src/pocketmine/Player.php
# src/pocketmine/VersionInfo.php
# src/pocketmine/block/Potato.php
# src/pocketmine/block/Sugarcane.php
# src/pocketmine/entity/Entity.php
# src/pocketmine/item/Item.php
# src/pocketmine/level/format/Chunk.php
# src/pocketmine/level/format/io/leveldb/LevelDB.php
# src/world/generator/GeneratorRegisterTask.php
# tests/phpstan/configs/check-explicit-mixed-baseline.neon
# tests/phpstan/configs/l7-baseline.neon
# tests/phpstan/configs/l8-baseline.neon
# tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskMainLoggerTest.php
# tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskMemoryLeakTest.php
# tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskPublishProgressRaceTest.php
2020-09-04 01:43:52 +01:00
279abb871d
Remove all usages of CompoundTag->hasTag()
...
in pretty much every case, these usages really wanted to read the tag's contents anyway, which can be combined with a getTag() and instanceof call for more concise and static analysis friendly code.
In the few cases where the tag contents wasn't needed, it still wanted to check the type, which, again, can be done in a more static analysis friendly way by just using getTag() and instanceof.
2020-07-10 21:01:43 +01:00
c762ec1319
Entity: removed unused field
2020-07-09 14:10:56 +01:00
31fd427710
Entity: remove usages of Chunk->getX()/getZ()
2020-07-08 20:29:30 +01:00
670ad9eb9d
Position: rename getWorldNonNull() to getWorld(), remove original getWorld()
2020-06-29 21:19:46 +01:00
2104b2d32b
Entity: defer kill() until post-construct
...
this fixes crashes and various bugs with death logic executing during the creation of entities, as well as an age-old Player crash after quitting the server when dying.
2020-06-27 23:28:03 +01:00
87ce92d87e
Entity: some cleanup of network position hacks
2020-06-27 23:16:04 +01:00
f1048aeaa3
Block: rework addVelocityToEntity() to avoid vector3 mutation
2020-06-27 21:38:24 +01:00
ff00595a48
Remove some more Vector3 mutations
2020-06-27 20:58:02 +01:00
80e150c803
Entity: get rid of temporalVector mutation
...
except for checkBlockCollision, these are all cold paths ... this gets us one step closer to immutable Vector3
2020-06-20 21:41:19 +01:00
d38c17835d
Properly switch to string entity IDs
2020-06-20 13:43:31 +01:00
47baaf4c72
move NBT helper functions from EntityFactory to EntityDataHelper
2020-06-19 22:04:36 +01:00
012acdd4cb
move runtime entity ID counter from EntityFactory back to Entity
...
EntityFactory is specialized for the purpose of deserializing data from worlds, and runtime ID assignment isn't related.
2020-06-19 21:55:49 +01:00
954e8e6e6f
update pocketmine/math dependency
2020-06-19 11:33:10 +01:00
60a6b4b10d
Entity: use EntityFactory helper function to deserialize Motion
2020-06-19 10:51:27 +01:00
4b528aa637
NBT is no longer needed to create an entity
...
it's still able to be provided, but shouldn't be needed in the majority of cases (constructor args and/or API methods should be sufficient).
2020-06-19 10:51:27 +01:00
1205432c34
Extract mandatory parameters into constructor parameters
...
the goal is obviously to ditch NBT entirely here, but there's more work to be done before that becomes possible.
2020-06-19 10:51:27 +01:00
cf85857660
Entity: remove duplicated code from saveNBT()
2020-06-19 01:07:18 +01:00
3e9018a838
Merge commit '7af4e70f6'
...
# Conflicts:
# resources/vanilla
# src/pocketmine/entity/Entity.php
2020-06-04 14:02:00 +01:00
6df43338df
Merge commit 'c3a795e87'
...
# Conflicts:
# resources/vanilla
# src/pocketmine/Player.php
# src/pocketmine/entity/Entity.php
2020-05-31 14:56:37 +01:00
6257f717b1
Entity: make networkProperties private
...
this reduces the temptation to use it in high-level code, as well as making syncNetworkData() more useful (now it can export to many data collections, which means we can start to think about having a property cache per network session, which is more flexible)
2020-05-21 20:29:06 +01:00
ec8ee29291
moving sneak & sprint properties to Living
2020-05-21 19:55:58 +01:00
3f1f135a59
remove a couple more Position->getWorld() usages
2020-05-19 21:38:51 +01:00
337addf1de
Eradicate remaining usages of public Position->world field
...
and as an added bonus, ditch a bunch of extra phpstan errors
2020-05-19 19:14:56 +01:00
8a8b1b0b97
Remove Position->setWorld()
2020-05-19 18:33:16 +01:00
148228e360
update pocketmine/math, adapt to add() changes
2020-05-19 12:26:18 +01:00
c30dd9f1b6
Entity: add abstract getNetworkTypeId(), remove NETWORK_ID constant
...
this now requires that subclasses supply a proper NETWORK_ID.
2020-05-16 16:08:12 +01:00
9cf410d484
Player: fixed broken behaviour of entity spawning on chunk send, closes #3355
2020-05-05 18:55:13 +01:00
81f982a8d9
remove hardcoded legacy entity type ID mapping, load from resources instead
2020-05-04 13:47:39 +01:00
8682ea35f7
Introduce some (not great) API for entity animations
...
while this API is a bit yucky, it's a step forward for protocol isolation and offers the possibility of controlling animations by adding events.
2020-05-01 13:57:26 +01:00
c8c0a1533c
NetworkSession: seal up actor removal behind API
2020-04-29 17:00:47 +01:00
4ce6525065
NetworkSession: incomplete abstraction of SetActorDataPacket handling
...
this needs to have the metadata properties separated too, but that's a job that's going to get VERY messy.
2020-04-29 16:50:52 +01:00
7d9df6af6f
Convert EntityFactory to singleton
2020-04-24 22:43:02 +01:00
86e051b7bf
Merge commit 'a2543ff80d2906bccda1a4e2fdbd9d8e7d147fb3'
2020-04-18 17:33:05 +01:00
da7ff9b1fe
Airgap Attribute, fix decoding of non-registered attributes for protocol debugging
2020-03-24 00:43:44 +00:00
b4b1877ce5
Merge branch 'next-minor'
2020-03-09 14:38:15 +00:00
aac7da6c96
eliminate remaining empty() usages
2020-02-07 21:51:50 +00:00
ff63f6d055
fill in more iterable types (master)
2020-02-01 20:19:57 +00:00
cb16f5c142
Merge commit '260ac47588c76a2e6814cfba46773a990fb8c5da'
...
# Conflicts:
# resources/vanilla
# src/Server.php
# src/lang/Language.php
# src/network/mcpe/protocol/AddItemActorPacket.php
# src/network/mcpe/protocol/AddPlayerPacket.php
# src/network/mcpe/protocol/SetActorDataPacket.php
# src/network/mcpe/serializer/NetworkBinaryStream.php
# src/permission/Permission.php
# src/pocketmine/block/Leaves.php
# src/pocketmine/entity/DataPropertyManager.php
# src/pocketmine/entity/Entity.php
# src/pocketmine/item/Banner.php
# src/pocketmine/item/Item.php
# src/pocketmine/level/format/io/LevelProvider.php
# src/pocketmine/level/format/io/LevelProviderManager.php
# src/pocketmine/network/mcpe/protocol/AddActorPacket.php
# src/pocketmine/network/mcpe/protocol/LoginPacket.php
# src/pocketmine/tile/Banner.php
# src/scheduler/BulkCurlTask.php
# src/updater/AutoUpdater.php
# src/utils/Config.php
# src/utils/Utils.php
# src/world/generator/Flat.php
# src/world/generator/Generator.php
2020-01-31 21:07:34 +00:00
eb6bb1aae1
Merge commit '839a789180cb3acd2e16006afa9b787903ffbbcd'
2020-01-31 19:16:09 +00:00
055b13a6cf
strip extra blank lines (php-cs-fixer)
2020-01-22 15:14:10 +00:00
a3bffd375b
master-specific addendum to cd55cdf5c6
2020-01-22 15:07:47 +00:00