Commit Graph

596 Commits

Author SHA1 Message Date
6a93eb8361 Merge branch 'stable' 2019-07-13 18:08:45 +01:00
c58a1bf9b7 Protocol changes for 1.12.0.28 2019-07-12 19:00:15 +01:00
e07523056d Merge branch 'stable' 2019-07-03 16:35:29 +01:00
3c7f68dc1e Fix Entity::isNameTagAlwaysVisible() was returning the wrong value (#2990)
* Fix Entity::isNameTagAlwaysVisible() was returning the wrong value

* "> 0" to "=== 1"
2019-07-02 10:44:41 +01:00
ee72680f44 Removing "metadata": overengineered useless Bukkit copy-pasta
the intentions of this are good, but the usability is terrible and it's not fit for purpose. Since there are a total of zero plugins on Poggit which use this garbage, it makes more sense to eliminate the technical debt. See #2766 for discussion about replacing this.
2019-06-26 14:43:21 +01:00
2559f5ec2b Moved Player-related classes to pocketmine\player namespace 2019-06-18 18:51:36 +01:00
287c8c2dd4 Added static create() functions for many packets
There are a few motivations here:
1) Less boilerplate code (this can be written inline)
2) It's possible to provide multiple constructors for different packet variations to reduce the chance of errors.
3) It makes things catch fire on updates in ways that static analysers can understand.
2019-06-05 15:00:08 +01:00
cf0c0e72a9 Assume the player is online when they are, uh, assumed to be online
the checks removed here should never be hit under normal circumstances. If they were hit, they'd just conceal bugs which would cause a crash to happen later anyway.
2019-05-07 19:49:06 +01:00
66481fedeb Entity: Protect internal methods setPosition() and setPositionAndRotation()
teleport() should be used instead (or setRotation() for rotation-only changes).
2019-05-07 17:38:33 +01:00
00944eff72 Removed EntityWorldChangeEvent
there's nothing that can be done with this event that can't be done with EntityTeleportEvent. Having this extra event needlessly increases system complexity.
2019-05-07 17:37:10 +01:00
3cd6e12e71 Renaming "Level" -> "World" (#2907)
This has been a pain point for a long time due to the misleading nature of the name "level". It's also confusing when trying to do things like getting the XP level of the player or such, and also does not translate well to other languages.

This transition was already executed on the UI some time ago (language strings) and now it's time for the same change to occur on the API.

This will burn a lot of plugins, but they'll acclimatize. Despite the scary size of this PR, there isn't actually so many changes to make. Most of this came from renaming `Position->getLevel()` to `Position->getWorld()`, or cosmetic changes like changing variable names or doc comments.
2019-05-07 14:47:28 +01:00
c5498bb3fa Implement a locking variable to circumvent a infinite regression (#2901)
closes #2876
2019-05-03 14:46:51 +01:00
0317b0f22d Merge branch 'next-minor' 2019-05-02 15:07:38 +01:00
d7a35a5302 Entity: fixed motion not being initialized when Motion NBT tag is missing
fixes CA 2355485
2019-05-02 14:00:28 +01:00
67e75d6c0a Moved DataPropertyManager to network namespace
this is _extremely_ network-focused code.
2019-04-26 18:57:44 +01:00
854a2f5135 Move a giant heap of network garbage out of Entity 2019-04-26 18:52:38 +01:00
c5ca623124 Merge branch 'stable' 2019-04-25 15:27:13 +01:00
fa70127241 1.11.0 protocol changes 2019-04-24 19:54:16 +01:00
5913d5038b Cleaned up Entity->close() handling 2019-04-18 17:23:48 +01:00
5f23fffdda Merge remote-tracking branch 'origin/3.7' 2019-04-12 18:33:13 +01:00
95313e0a90 Updated some entity metadata properties 2019-04-08 14:42:33 +01:00
9ec62643d5 Player construction now happens when we're ready to create the player entity
this fixes a wide range of bugs with the initial spawn sequence, and allows to simplify a whole lot of player setup logic.
2019-03-23 10:13:14 +00:00
89c0836047 Fixed paintings dropping multiple times, closes #2774 2019-03-21 19:46:43 +00:00
8c536c248d Updating for latest PocketMine-NBT changes 2019-03-21 15:58:22 +00:00
6f54b53f7a thanks for being useless PhpStorm
these problems didn't show up in any inspections until I opened the fucking files...
2019-03-17 15:53:59 +00:00
0659d2fbef Backport 6bd43a8215: Firehose auto-tick-rate anti-feature, closes #2665 2019-03-09 19:20:53 +00:00
6bd43a8215 Firehose auto-tick-rate anti-feature, closes #2665 2019-03-03 13:24:53 +00:00
6c8fa8ae28 More nullable and void typehints 2019-03-02 10:29:11 +00:00
c2735286ab Merge branch '3.6' 2019-02-17 11:35:07 +00:00
e16d8e31af Merge branch '3.5' into 3.6 2019-02-17 11:33:46 +00:00
3c93a57397 Entity: add a hack to prevent client-side movement when entity is not moving
this fixes #2227.
2019-02-17 11:33:34 +00:00
9ebd559907 Merge branch '3.6' 2019-02-10 13:59:44 +00:00
9da7c6af27 new metadata properties 2019-02-10 13:59:21 +00:00
c6a5829a92 Entity: remove dead function 2019-02-04 19:54:18 +00:00
c872b120d0 Entity->entityBaseTick() is now protected 2019-02-04 19:54:06 +00:00
ac551cf248 Entity: add addMotion() to allow updating motion vector
this allows updating motion without needing to create new objects for the task.
2019-01-27 15:43:57 +00:00
bccc07633c Entity: Allow disabling gravity for a mob 2019-01-27 15:42:46 +00:00
6ee484e401 ChunkLoader: remove getLoaderId() (take 2) 2019-01-25 18:58:01 +00:00
4ae6428641 Level: rename getCollisionCubes() -> getCollisionBoxes()
these aren't cubes! shoghi, please read the dictionary.
2019-01-20 18:11:20 +00:00
425ad6101f Block: rename onEntityCollide() -> onEntityInside()
this better describes what the hook is for.
2019-01-20 18:09:47 +00:00
6df983da3e Merge branch '3.5' 2019-01-19 16:24:41 +00:00
4fd3bee360 Entity: Address fireticks crashdumps
This will now throw an exception at the source instead of crashing when the entity is saved, which should put the blame on the correct plugin responsible for this.
This also includes magic method hacks to preserve backwards compatibility, since the fireTicks field is now protected.
2019-01-19 16:05:10 +00:00
797aabdf15 Entity: Protect move() to avoid stupidity 2019-01-14 19:57:46 +00:00
5052b75565 Separate Level management functionality from Server, clean up a bunch of mess 2019-01-12 19:11:05 +00:00
19614ed25e Entity: move some NBT usages out of constructor, fix missing property defaults 2019-01-10 21:01:19 +00:00
7d827a1c65 Introduce EntityFactory
This contains all of the static stuff that was previously embedded in the Entity static root. This solves a bunch of problems like circular dependencies between parent and child classes, encapsulating logic and reducing the size of the enormous Entity.php.
2019-01-06 23:54:29 +00:00
b1cef8509a Revamp Entity construction
This is a similar refactor to the one I recently did for tiles.

- Entity::createEntity() is removed. In its place are Entity::create() (runtime creation, use where you'd use a constructor, accepts a ::class parameter, throws exceptions on unknown entities) and Entity::createFromData() (internal, used to restore entities from chunks, swallows unknown entities and returns null).
- Entity::registerEntity() is renamed to Entity::register().
- Added Entity::override() to allow overriding factory classes without touching save IDs. This allows more cleanly extending & overriding entities. This method only allows overriding registered Entity classes with children of that class, which makes code using the factory much more sane and allows to provide safety guarantees which make the code less nasty.
- Entity::getKnownEntityTypes() is renamed to Entity::getKnownTypes().
- ProjectileItem::getProjectileEntityType() now returns a ::class constant instead of a stringy ID.
- Cleaned up a bunch of nasty code, particularly in Bow.
2019-01-06 23:33:36 +00:00
adc1069ed2 Merge branch '3.5' 2019-01-04 23:28:44 +00:00
4b9a142a5d Import global functions and constants for enhanced performance
This is better for performance because these then don't need to be reevaluated every time they are called.

When encountering an unqualified function or constant reference, PHP will first try to locate a symbol in the current namespace by that name, and then fall back to the global namespace.
This short-circuits the check, which has substantial performance effects in some cases - in particular, ord(), chr() and strlen() show ~1500x faster calls when they are fully qualified.

However, this doesn't mean that PM is getting a massive amount faster. In real world terms, this translates to about 10-15% performance improvement.
But before anyone gets excited, you should know that the CodeOptimizer in the PreProcessor repo has been applying fully-qualified symbol optimizations to Jenkins builds for years, which is one of the reasons why Jenkins builds have better performance than home-built or source installations.
We're choosing to do this for the sake of future SafePHP integration and also to be able to get rid of the buggy CodeOptimizer, so that phar and source are more consistent.
2019-01-04 20:43:15 +00:00
5bb414620c Merge branch '3.5' 2019-01-02 15:05:19 +00:00