diff --git a/src/API/ServerAPI.php b/src/API/ServerAPI.php index c21cb93c..eab95691 100644 --- a/src/API/ServerAPI.php +++ b/src/API/ServerAPI.php @@ -4,6 +4,10 @@ class ServerAPI{ private static $serverRequest = false; public $restart = false; + + /** + * @var QueryAPI + */ public $queryAPI; /** @@ -48,6 +52,11 @@ class ServerAPI{ * @var AchievementAPI */ public $achievement; + /** + * @var PluginAPI + */ + public $plugin; + private $asyncCalls = []; private $server; private $config; diff --git a/src/entity/Entity.php b/src/entity/Entity.php index 8d478023..ee596424 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -564,7 +564,7 @@ class Entity extends Position $x0 = floor($aABB->minX); $x1 = ceil($aABB->maxX); $y0 = floor($aABB->minY); - $y1 = round($aABB->maxY); + $y1 = ceil($aABB->maxY); $z0 = floor($aABB->minZ); $z1 = ceil($aABB->maxZ); $x0 = $x0 < 0 ? 0 : $x0; @@ -629,14 +629,14 @@ class Entity extends Position } break; } - if($this->isMoving() && $b != false && $b->isSolid && $b->boundingBox->intersectsWith($aABB)){ - $this->speedX = $b->boundingBox->calculateXOffset($this->boundingBox, $this->speedX); - $this->speedZ = $b->boundingBox->calculateZOffset($this->boundingBox, $this->speedZ); + if($b != false && ($b->isSolid && $b->boundingBox->intersectsWith($aABB))){ $lastY = $this->speedY; $this->speedY = $b->boundingBox->calculateYOffset($this->boundingBox, $this->speedY); if($this->speedY == 0 && $lastY > 0){ $support = true; } + $this->speedX = $b->boundingBox->calculateXOffset($this->boundingBox, $this->speedX); + $this->speedZ = $b->boundingBox->calculateZOffset($this->boundingBox, $this->speedZ); } } } diff --git a/src/entity/animal/Chicken.php b/src/entity/animal/Chicken.php index a2f1a062..c45d051d 100644 --- a/src/entity/animal/Chicken.php +++ b/src/entity/animal/Chicken.php @@ -5,10 +5,10 @@ class Chicken extends Animal{ public $timeUntilEgg; function __construct(Level $level, $eid, $class, $type = 0, $data = []){ $this->timeUntilEgg = mt_rand(0,6000) + 6000; + $this->setSize($this->isBaby() ? 0.2 : 0.3, $this->isBaby() ? 0.35 : 0.4); parent::__construct($level, $eid, $class, $type, $data); $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 4, "generic"); $this->setName('Chicken'); - $this->setSize($this->isBaby() ? 0.2 : 0.3, $this->isBaby() ? 0.35 : 0.4); $this->setSpeed(0.25); $this->update(); } diff --git a/src/entity/animal/Cow.php b/src/entity/animal/Cow.php index 2723153e..cc98e5d7 100644 --- a/src/entity/animal/Cow.php +++ b/src/entity/animal/Cow.php @@ -3,9 +3,9 @@ class Cow extends Animal{ const TYPE = MOB_COW; function __construct(Level $level, $eid, $class, $type = 0, $data = []){ + $this->setSize($this->isBaby() ? 0.45 : 0.9 , $this->isBaby() ? 0.7 : 1.4); parent::__construct($level, $eid, $class, $type, $data); $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 10, "generic"); - $this->setSize($this->isBaby() ? 0.45 : 0.9 , $this->isBaby() ? 0.7 : 1.4); $this->setName("Cow"); $this->setSpeed(0.2); $this->update(); diff --git a/src/entity/animal/Pig.php b/src/entity/animal/Pig.php index a6d37f37..37a4ad40 100644 --- a/src/entity/animal/Pig.php +++ b/src/entity/animal/Pig.php @@ -3,10 +3,10 @@ class Pig extends Animal implements Rideable{ const TYPE = MOB_PIG; public function __construct(Level $level, $eid, $class, $type = 0, $data = []){ + $this->setSize($this->isBaby() ? 0.45 : 0.9, $this->isBaby() ? 0.45 : 0.9); parent::__construct($level, $eid, $class, $type, $data); $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"]:10, "generic"); $this->server = ServerAPI::request(); - $this->setSize($this->isBaby() ? 0.45 : 0.9, $this->isBaby() ? 0.45 : 0.9); $this->setName("Pig"); $this->setSpeed(0.25); $this->update(); diff --git a/src/entity/animal/Sheep.php b/src/entity/animal/Sheep.php index 3b7a9826..049b0d6e 100644 --- a/src/entity/animal/Sheep.php +++ b/src/entity/animal/Sheep.php @@ -4,12 +4,12 @@ class Sheep extends Animal{ public $color; const TYPE = MOB_SHEEP; function __construct(Level $level, $eid, $class, $type = 0, $data = []){ + $this->setSize($this->isBaby() ? 0.45 : 0.9, $this->isBaby() ? 0.675 : 1.3); parent::__construct($level, $eid, $class, $type, $data); $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 8, "generic"); $this->setName("Sheep"); $this->data["Sheared"] = isset($this->data["Sheared"]) ? $this->data["Sheared"] : 0; $this->data["Color"] = isset($this->data["Color"]) ? $this->data["Color"] : $this->sheepColor(); - $this->setSize($this->isBaby() ? 0.45 : 0.9, $this->isBaby() ? 0.675 : 1.3); $this->setSpeed(0.25); $this->update(); if($this->isSheared() and Entity::$updateOnTick){ //if ai enabled diff --git a/src/entity/monster/Creeper.php b/src/entity/monster/Creeper.php index 9a39aed3..796146d9 100644 --- a/src/entity/monster/Creeper.php +++ b/src/entity/monster/Creeper.php @@ -4,11 +4,11 @@ class Creeper extends Monster{ const EXPL_TIME = 30; public $timeUntilExplode; function __construct(Level $level, $eid, $class, $type = 0, $data = []){ + $this->setSize(0.6, 1.7); parent::__construct($level, $eid, $class, $type, $data); $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 16, "generic"); $this->setName("Creeper"); $this->ignited = 0; - $this->setSize(0.6, 1.7); $this->setSpeed(0.25); $this->update(); $this->timeUntilExplode = $this->isIgnited() ? self::EXPL_TIME : 0; diff --git a/src/entity/monster/PigZombie.php b/src/entity/monster/PigZombie.php index 5675ed5c..f0851f76 100644 --- a/src/entity/monster/PigZombie.php +++ b/src/entity/monster/PigZombie.php @@ -2,9 +2,9 @@ class PigZombie extends Monster{ const TYPE = MOB_PIGMAN; function __construct(Level $level, $eid, $class, $type = 0, $data = []){ + $this->setSize(0.3, 1.95); parent::__construct($level, $eid, $class, $type, $data); $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 12, "generic"); - $this->setSize(0.3, 1.95); $this->setName("Pigman"); $this->setSpeed(0.25); $this->update(); diff --git a/src/entity/monster/Skeleton.php b/src/entity/monster/Skeleton.php index c1567d7f..5765f34a 100644 --- a/src/entity/monster/Skeleton.php +++ b/src/entity/monster/Skeleton.php @@ -2,10 +2,10 @@ class Skeleton extends Monster{ const TYPE = MOB_SKELETON; function __construct(Level $level, $eid, $class, $type = 0, $data = []){ + $this->setSize(0.6, 1.99); parent::__construct($level, $eid, $class, $type, $data); $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 10, "generic"); $this->setName("Skeleton"); - $this->setSize(0.6, 1.99); $this->setSpeed(0.25); $this->update(); } diff --git a/src/entity/monster/Spider.php b/src/entity/monster/Spider.php index 1a18e0ca..b3f41f60 100644 --- a/src/entity/monster/Spider.php +++ b/src/entity/monster/Spider.php @@ -2,10 +2,10 @@ class Spider extends Monster{ const TYPE = MOB_SPIDER; function __construct(Level $level, $eid, $class, $type = 0, $data = array()){ + $this->setSize(1.4, 0.9); parent::__construct($level, $eid, $class, $type, $data); $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 8, "generic"); $this->setName("Spider"); - $this->setSize(1.4, 0.9); $this->setSpeed(0.3); $this->update(); } diff --git a/src/entity/monster/Zombie.php b/src/entity/monster/Zombie.php index 4c6894c8..0bed4521 100644 --- a/src/entity/monster/Zombie.php +++ b/src/entity/monster/Zombie.php @@ -2,10 +2,10 @@ class Zombie extends Monster{ const TYPE = MOB_ZOMBIE; function __construct(Level $level, $eid, $class, $type = 0, $data = array()){ + $this->setSize(0.6, 1.85); parent::__construct($level, $eid, $class, $type, $data); $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 12, "generic"); $this->setName("Zombie"); - $this->setSize(0.6, 1.85); $this->setSpeed(0.23); $this->update(); }