4 bugs were fixed

This commit is contained in:
GameHerobrine 2022-11-13 18:52:48 +03:00
parent 107afb434b
commit 828599184c
5 changed files with 9 additions and 5 deletions

View file

@ -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);

View file

@ -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()){

View file

@ -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;
}

View file

@ -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]
];
}

View file

@ -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,