947 Commits

Author SHA1 Message Date
Dylan K. Taylor
797aabdf15 Entity: Protect move() to avoid stupidity 2019-01-14 19:57:46 +00:00
Dylan K. Taylor
9c53b41851 Added PlayerInfo, Player is no longer accessible during PlayerPreLoginEvent 2019-01-13 19:32:30 +00:00
Dylan K. Taylor
5052b75565 Separate Level management functionality from Server, clean up a bunch of mess 2019-01-12 19:11:05 +00:00
Dylan K. Taylor
19614ed25e Entity: move some NBT usages out of constructor, fix missing property defaults 2019-01-10 21:01:19 +00:00
Dylan K. Taylor
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
Dylan K. Taylor
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
Dylan K. Taylor
cdf2f98e26 Merge branch '3.5' 2019-01-05 17:41:26 +00:00
Dylan K. Taylor
b22a2ef914 Living: Despawn in endDeathAnimation()
this removes the necessity for the player to do this.
2019-01-05 12:46:11 +00:00
Dylan K. Taylor
adc1069ed2 Merge branch '3.5' 2019-01-04 23:28:44 +00:00
Dylan K. Taylor
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
Dylan K. Taylor
5bb414620c Merge branch '3.5' 2019-01-02 15:05:19 +00:00
Dylan K. Taylor
8650c187f9 Entity: fixed mob head yaw 2019-01-02 15:04:56 +00:00
Dylan K. Taylor
ae497a828f Merge branch 'release/3.5' 2018-12-30 17:33:31 +00:00
Dylan K. Taylor
d2d65ce6cc Attribute: Fix exception messages, make them less useless 2018-12-30 13:44:30 +00:00
Dylan K. Taylor
e5cb48bec2 Merge branch 'release/3.5' 2018-12-22 13:31:18 +00:00
Dylan K. Taylor
42f8e061a5 Merge branch 'release/3.4' into release/3.5 2018-12-22 13:29:41 +00:00
Dylan K. Taylor
0299191e64 Attribute: fit value when resetting to default, closes #2599 2018-12-22 11:44:36 +00:00
Dylan K. Taylor
2506947641 Merge branch 'release/3.5' 2018-12-20 20:01:02 +00:00
Dylan K. Taylor
ea9f9aa250 Update some non-critical protocol magic numbers 2018-12-20 19:59:42 +00:00
Dylan K. Taylor
20aaa8373a Sound no longer extends Vector3 2018-12-16 14:26:42 +00:00
Dylan K. Taylor
3c520aa786 Particle no longer extends Vector3 2018-12-16 14:15:41 +00:00
Dylan K. Taylor
c5262fdf61 Merge branch 'release/3.5' 2018-12-14 17:32:58 +00:00
Dylan K. Taylor
4b518f2a58 Merge branch 'release/3.4' into release/3.5 2018-12-14 17:32:34 +00:00
Dylan K. Taylor
60b1f0a6e9 Fixed burning TNT setting affected mobs on fire when exploding, closes #2561 2018-12-14 17:32:11 +00:00
Dylan K. Taylor
e0558d2551 Merge branch 'release/3.5' 2018-12-14 10:03:36 +00:00
Dylan K. Taylor
c05697f506 Merge branch 'release/3.4' into release/3.5 2018-12-14 09:39:21 +00:00
Dylan K. Taylor
cbb9c4f298 Entity: require scale > 0 in setScale(), fixes #2563 2018-12-14 09:30:14 +00:00
Dylan K. Taylor
ffa733fe0c Merge branch 'release/3.5' 2018-12-12 19:51:41 +00:00
Dylan K. Taylor
30f5a8fac6 Protocol changes for 1.8.0 release 2018-12-11 21:05:03 +00:00
Dylan K. Taylor
8dbeda69a7 Make use of Facing::rotateY() to reduce boilerplate 2018-12-07 10:49:12 +00:00
Dylan K. Taylor
39e383a175 Entity: add getHorizontalFacing(), clean up some boilerplate code 2018-12-05 20:27:43 +00:00
Dylan K. Taylor
b50e29085e Remove InventoryEventProcessor, use closures instead 2018-12-04 19:02:26 +00:00
Dylan K. Taylor
9fb365306a Make Block->position() accept Level,x,y,z instead of Position
since this is an internal method, it doesn't make sense to force a single parameter that requires potentially constructing a separate object just for the parameters, so we pass primitives instead, which are also easier to typehint against.
2018-12-03 21:18:22 +00:00
Dylan K. Taylor
df9534e220 Merge branch 'release/3.4' 2018-12-02 16:44:03 +00:00
Dylan K. Taylor
b0f891081c Mark EXHAUSTION as non-syncable
this attribute is not visible on the client and is only used for controlling saturation depletion. It's extremely spammy and as such really shouldn't be sent over network. This has also been causing some minor client-side performance issues in survival.
2018-12-02 16:43:00 +00:00
Dylan K. Taylor
790ef0325c Merge branch 'release/3.4' 2018-11-29 18:47:25 +00:00
Dylan K. Taylor
c010ef45ed Merge branch 'release/3.3' into release/3.4 2018-11-29 18:46:00 +00:00
Dylan K. Taylor
93c26a0b0c Living: Suspend effects ticking on death
This was the cause of a bug with regeneration which caused players taking fatal damage under regeneration not to die correctly. On the server side they would die and immediately regenerate some health, which would cause the next attribute sync to not report the health drop to zero, which made the client unaware that it was dead.

Perhaps attributes should be forcibly synced in some circumstances, but nonetheless regeneration shouldn't apply post-death.
2018-11-29 18:45:46 +00:00
Dylan K. Taylor
d8ea8fa0f0 Use Block objects more instead of legacy ID/meta crap 2018-11-25 14:55:12 +00:00
Dylan K. Taylor
6e05b5cc4b Merge branch 'release/3.4' 2018-11-04 11:57:40 +00:00
Dylan K. Taylor
055ba6aa7c Merge branch 'release/3.3' into release/3.4 2018-11-04 11:57:35 +00:00
Dylan K. Taylor
5c3eed40b3 Merge branch 'release/3.2' into release/3.3 2018-11-04 11:57:28 +00:00
Dylan K. Taylor
3e5237b6e0 ItemEntity: remove useless instanceof 2018-11-04 11:57:22 +00:00
Dylan K. Taylor
90482e79bc Merge branch 'release/3.4' 2018-10-21 18:23:54 +01:00
Dylan K. Taylor
6dd2597934 Merge branch 'release/3.3' into release/3.4 2018-10-21 18:17:07 +01:00
Dylan K. Taylor
5e68858ebf Merge branch 'release/3.2' into release/3.3 2018-10-21 18:16:59 +01:00
Dylan K. Taylor
45c9caa38c Fixup some formatting issues 2018-10-21 18:15:25 +01:00
Dylan K. Taylor
bae140dc02 Entity: remove dead code 2018-10-20 19:05:39 +01:00
Dylan K. Taylor
fb128d0276 Merge branch 'release/3.4' 2018-10-20 16:43:25 +01:00
Dylan K. Taylor
4aef9919dc Use newly added API method 2018-10-20 16:26:10 +01:00