mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-20 12:44:01 +00:00
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.