diff --git a/src/entity/Animal.php b/src/entity/Animal.php index 7600a371..ca929158 100644 --- a/src/entity/Animal.php +++ b/src/entity/Animal.php @@ -10,7 +10,6 @@ abstract class Animal extends Creature implements Ageable, Breedable{ public $age; public function __construct(Level $level, $eid, $class, $type = 0, $data = []){ parent::__construct($level, $eid, $class, $type, $data); - $this->setAge(isset($data["Age"]) ? $data["Age"] : 0); if(isset($this->data["IsBaby"]) && $this->data["IsBaby"] && $this->getAge() >= 0){ $this->setAge(-24000); diff --git a/src/entity/Entity.php b/src/entity/Entity.php index 47f2df05..57189385 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -170,7 +170,6 @@ class Entity extends Position break; } $this->boundingBox = new AxisAlignedBB($this->x - $this->radius, $this->y, $this->z - $this->radius, $this->x + $this->radius, $this->y + $this->height, $this->z + $this->radius); - $this->update(); $this->updateLast(); $this->updatePosition(); if($this->isInVoid()){ diff --git a/src/entity/animal/Chicken.php b/src/entity/animal/Chicken.php index a0fead64..44c2cc2f 100644 --- a/src/entity/animal/Chicken.php +++ b/src/entity/animal/Chicken.php @@ -18,7 +18,7 @@ class Chicken extends Animal{ public function update(){ parent::update(); - if($this->timeUntilEgg-- <= 0){ + if($this->timeUntilEgg-- <= 0 && !$this->isBaby()){ $this->dropAnEgg(); $this->timeUntilEgg = mt_rand(0,6000) + 6000; } diff --git a/src/entity/animal/Sheep.php b/src/entity/animal/Sheep.php index 2a4c03f2..b5bcf900 100644 --- a/src/entity/animal/Sheep.php +++ b/src/entity/animal/Sheep.php @@ -53,7 +53,7 @@ class Sheep extends Animal{ } public function getDrops(){ - return $this->isBaby() ? parent::getDrops() : [ + return ($this->isBaby() || $this->isSheared()) ? parent::getDrops() : [ [WOOL, $this->getColor() & 0x0F, 1] ]; } diff --git a/src/material/block/attachable/Trapdoor.php b/src/material/block/attachable/Trapdoor.php index 5b59332e..31ffb8ee 100644 --- a/src/material/block/attachable/Trapdoor.php +++ b/src/material/block/attachable/Trapdoor.php @@ -11,8 +11,14 @@ class TrapdoorBlock extends TransparentBlock{ } $this->hardness = 15; } + + public function canAttachTo(Block $target){ + $id = $target->getID(); + return $id === SLAB || $id === GLOWSTONE || $id === SLAB || $id === WOOD_SLAB || (!$target->isTransparent || $target instanceof StairBlock); + } + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ - if(($target->isTransparent === false or $target->getID() === SLAB) and $face !== 0 and $face !== 1){ + if(($this->canAttachTo($target)) and $face !== 0 and $face !== 1){ $faces = array( 2 => 0, 3 => 1,