mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 20:19:44 +00:00
moved 2 more entities to separate classes, no more 1.0.2
This commit is contained in:
parent
96bb79cdcb
commit
0946e8f3a2
9 changed files with 48 additions and 21 deletions
|
|
@ -8,6 +8,7 @@ class EntityList{
|
|||
$this->entities[$property->getEntityType()] = $property;
|
||||
}
|
||||
public function getEntityFromTypeAndClass($type, $class){
|
||||
if($class === ENTITY_ITEM) return $this->entities["itemSpecial"];
|
||||
return isset($this->entities[$type]) && $this->entities[$type]->getEntityClass() === $class ? $this->entities[$type] : 0;
|
||||
}
|
||||
private $entities = [];
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
class EntityRegistry{
|
||||
public static $entityList;
|
||||
|
||||
/*Register all entities*/
|
||||
public static function registerEntities(){
|
||||
console("[INFO] Registering entities...");
|
||||
|
|
@ -19,6 +20,8 @@ class EntityRegistry{
|
|||
self::registerEntity(PrimedTNT::class);
|
||||
self::registerEntity(Painting::class);
|
||||
self::registerEntity(Minecart::class);
|
||||
self::registerEntity(FallingSand::class);
|
||||
self::registerEntity(ItemEntity::class);
|
||||
}
|
||||
|
||||
/*Register an Entity*/
|
||||
|
|
@ -26,6 +29,7 @@ class EntityRegistry{
|
|||
$class = new \ReflectionClass($className);
|
||||
if(is_a($className, Entity::class, true) and !$class->isAbstract()){
|
||||
//self::$entityList[$className::TYPE] = $className;
|
||||
|
||||
self::$entityList->addEntity(new PropertyEntity($className::CLASS_TYPE, $className::TYPE, $className));
|
||||
//self::$shortNames[$className] = $class->getShortName(); what is this even supposed to do?
|
||||
//console("[INFO] Registered a ".$className);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue