183 Commits

Author SHA1 Message Date
Dylan K. Taylor
600ef033ab PlayerSkinPacket: added ::create() 2020-07-09 13:24:31 +01:00
Dylan K. Taylor
31fd427710 Entity: remove usages of Chunk->getX()/getZ() 2020-07-08 20:29:30 +01:00
Dylan K. Taylor
da798817b5 Merge branch 'stable'
# Conflicts:
#	changelogs/3.14.md
#	resources/vanilla
#	src/VersionInfo.php
#	src/entity/Attribute.php
2020-07-08 11:46:02 +01:00
Dylan K. Taylor
909f3f39de Block: get rid of getRuntimeId()
the runtime ID mapping should be non-global in case of multiple protocols.
2020-07-06 11:18:29 +01:00
Dylan K. Taylor
670ad9eb9d Position: rename getWorldNonNull() to getWorld(), remove original getWorld() 2020-06-29 21:19:46 +01:00
Dylan T
d585081c22
Separate consumable item interfaces from general consumable interfaces (#3595)
I wonder if there's a way to generalise item consuming beyond just eating/drinking. Stuff like lava bucket in a furnace needs the same kind of "leftover" logic.
2020-06-28 17:53:03 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
87ce92d87e Entity: some cleanup of network position hacks 2020-06-27 23:16:04 +01:00
Dylan K. Taylor
1f0ea0c2c7 Living: stop mutating Vector3 2020-06-27 21:51:42 +01:00
Dylan K. Taylor
f1048aeaa3 Block: rework addVelocityToEntity() to avoid vector3 mutation 2020-06-27 21:38:24 +01:00
Dylan K. Taylor
ff00595a48 Remove some more Vector3 mutations 2020-06-27 20:58:02 +01:00
Dylan K. Taylor
7e331c590d Use static-analysis-friendly method for getting effects from EffectManager
fixes 5 phpstan level 8 errors
2020-06-27 13:09:05 +01:00
Dylan K. Taylor
9e6f1c9a5a Living: check if damager is null before trying to use it 2020-06-27 13:09:05 +01:00
Dylan K. Taylor
b7b5ea6fc9 Painting: use motive directly internally
this is cleaner and also fixes a phpstan level 8 error
2020-06-27 13:09:05 +01:00
Dylan K. Taylor
3c1b8b83f5 HungerManager: use AttributeMap->mustGet()
fixes 2 errors on phpstan level 8
2020-06-27 13:09:05 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
d38c17835d Properly switch to string entity IDs 2020-06-20 13:43:31 +01:00
Dylan K. Taylor
4e8e10ca45 EntityFactory: remove obsolete indirection (class mappings are redundant here now) 2020-06-19 22:18:42 +01:00
Dylan K. Taylor
0a43fd816c EntityFactory: drop unnecessary @param 2020-06-19 22:10:35 +01:00
Dylan K. Taylor
47baaf4c72 move NBT helper functions from EntityFactory to EntityDataHelper 2020-06-19 22:04:36 +01:00
Dylan K. Taylor
1a3445f4b5 EntityFactory: drop automatic provisioning of short class name as save ID 2020-06-19 22:03:22 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
6d3750994b EntityFactory: remove dead function 2020-06-19 21:54:23 +01:00
Dylan K. Taylor
954e8e6e6f update pocketmine/math dependency 2020-06-19 11:33:10 +01:00
Dylan K. Taylor
9f89f2887a Location: x,y,z parameters are now mandatory 2020-06-19 11:19:05 +01:00
Dylan K. Taylor
4b0bf34adb Location: add native typehints 2020-06-19 11:17:20 +01:00
Dylan K. Taylor
60a6b4b10d Entity: use EntityFactory helper function to deserialize Motion 2020-06-19 10:51:27 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
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
Dylan K. Taylor
6a26c0bebf EntityFactory now exclusively handles loading data from disk
this commit removes the ability to replace centrally registered entity classes in favour of using constructors directly.
In future commits I may introduce a dedicated factory interface which allows an _actual_ factory pattern (e.g. factory->createArrow(world, pos, shooter, isCritical) with proper static analysability) but for now it's peripheral to my intended objective.
The purpose of this change is to facilitate untangling of NBT from entity constructors so that they can be properly created without using NBT at all, and instead use nice APIs.

Spawn eggs now support arbitrary entity creation functions like EntityFactory does, allowing much more flexibility in what can be passed to an entity's constructor (e.g. a Plugin reference can be injected by use()ing it in a closure or via traditional DI.
2020-06-19 10:51:27 +01:00
Dylan K. Taylor
72a7fc68c1 First look at making entity creation closure-driven
this allows doing stuff like injecting plugin references to entity constructors for now. I want to make this more flexible still, but I've done about as much as I feel like doing today and don't want this disappearing into a stash to never be seen again.
2020-06-19 10:51:27 +01:00
Dylan K. Taylor
ced89add3c Human: remove dead function 2020-06-19 01:13:00 +01:00
Dylan K. Taylor
cf85857660 Entity: remove duplicated code from saveNBT() 2020-06-19 01:07:18 +01:00
Dylan K. Taylor
b3df5f4e95 CS: strip unneeded phpdoc 2020-06-18 20:01:49 +01:00
Dylan K. Taylor
14d3e5ce27 Merge commit '62ea7c93a9ba1e71bef868efefdd9cc6dcc84a08'
# Conflicts:
#	resources/vanilla
#	src/entity/Skin.php
#	src/item/InvalidSkinException.php
2020-06-17 20:34:19 +01:00
Dylan K. Taylor
3e9018a838 Merge commit '7af4e70f6'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/entity/Entity.php
2020-06-04 14:02:00 +01:00
Dylan K. Taylor
b58c425189 Merge branch 'next-minor'
# Conflicts:
#	changelogs/3.12.md
#	resources/vanilla
#	src/VersionInfo.php
2020-06-03 13:11:30 +01:00
Dylan K. Taylor
2bf73c7a4a Merge commit '8c5a81cf5'
# Conflicts:
#	resources/vanilla
2020-06-03 12:50:09 +01:00
Dylan K. Taylor
e7d712aeb6 Merge commit '2b58f2baf'
# Conflicts:
#	resources/vanilla
#	src/entity/object/FallingBlock.php
2020-06-03 12:47:44 +01:00
Dylan K. Taylor
c72937a4af Merge commit '5dadf1237'
# Conflicts:
#	resources/vanilla
2020-06-03 12:46:06 +01:00
Dylan K. Taylor
6df43338df Merge commit 'c3a795e87'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
#	src/pocketmine/entity/Entity.php
2020-05-31 14:56:37 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
1aa92bd6a8 Living: Do not rely on attribute map for moveSpeed attribute access 2020-05-21 20:13:24 +01:00
Dylan K. Taylor
f77eea8c44 Living: set SPRINTING flag when it's needed, close #3521 2020-05-21 20:01:37 +01:00
Dylan K. Taylor
ec8ee29291 moving sneak & sprint properties to Living 2020-05-21 19:55:58 +01:00
Dylan K. Taylor
74e1f6320a Store attributes as local vars, reduce usage of AttributeMap
ideally we want attribute map to only be used for properties that need synchronization.
2020-05-21 19:18:00 +01:00
Dylan K. Taylor
f93bc0739c Force types of RegistryTrait usages to shut PHPStan up
we need generic traits to solve this problem properly.
2020-05-21 19:12:48 +01:00
Dylan K. Taylor
7aca41a530 Living: do not loop downwards searching for collision block, closes #3517 2020-05-20 20:33:25 +01:00
Dylan K. Taylor
3f1f135a59 remove a couple more Position->getWorld() usages 2020-05-19 21:38:51 +01:00
Dylan K. Taylor
45ec4645d2 Merge commit '089180fef4534b383a31a9d560a76bfaf0d16c6b'
# Conflicts:
#	resources/vanilla
#	src/entity/Living.php
2020-05-19 21:14:54 +01:00