From fccca5827f63214ad2507564f7f77a009daf74bf Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Tue, 11 Feb 2014 16:20:51 +0100 Subject: [PATCH] Moar --- src/Entity.php | 73 +++++++++++++++++++++++++++++++++- src/entity/ColorableEntity.php | 24 +++++++++++ 2 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 src/entity/ColorableEntity.php diff --git a/src/Entity.php b/src/Entity.php index f9f01d9a2..2f0322135 100644 --- a/src/Entity.php +++ b/src/Entity.php @@ -20,7 +20,77 @@ */ abstract class Entity extends Position{ - + private static $entityCount = 1; + private $id; + + //public $passenger = null; + //public $vehicle = null; + + public $lastX; + public $lastY; + public $lastZ; + public $velocity; + public $yaw; + public $pitch; + public $lastYaw; + public $lastPitch; + //public $boundingBox; + public $onGround; + public $positionChanged; + public $velocityChanged; + public $dead; + public $height; + public $width; + public $length; + public $fallDistance; + public $ticksLived; + public $maxFireTicks; + public $fireTicks; + protected $inWater; + public $noDamageTicks; + private $justCreated; + protected $fireProof; + private $invulnerable; + + + public function __construct(Level $level){ + $this->id = Entity::$entityCount++; + $this->justCreated = true; + $this->level = $level; + } + + public function getPosition(){ + return new Position($this->x, $this->y, $this->z, $this->level); + } + + public function setVelocity(Vector3 $velocity){ + $this->velocity = clone $velocity; + } + + public function getVelocity(){ + return clone $this->velocity; + } + + public function isOnGround(){ + return $this->onGround === true; + } + + public function getLevel(){ + return $this->level; + } + + public function teleport(Position $pos){ + + } + + public function equals($object){ + return $object instanceof Entity ? $object->getID() === $this->id : false; + } + + public function getID(){ + return $this->id; + } + } /***REM_START***/ @@ -29,6 +99,7 @@ require_once("entity/ProjectileSourceEntity.php"); require_once("entity/RideableEntity.php"); require_once("entity/AttachableEntity.php"); require_once("entity/ExplosiveEntity.php"); +require_once("entity/ColorableEntity.php"); require_once("entity/LivingEntity.php"); require_once("entity/CreatureEntity.php"); diff --git a/src/entity/ColorableEntity.php b/src/entity/ColorableEntity.php new file mode 100644 index 000000000..d49f4135c --- /dev/null +++ b/src/entity/ColorableEntity.php @@ -0,0 +1,24 @@ +