water damage tweaks, using php8 pack functions

This commit is contained in:
GameHerobrine 2024-01-01 08:15:05 +03:00
parent 229a563ff5
commit 68b8232f07
17 changed files with 46 additions and 76 deletions

View file

@ -10,7 +10,6 @@ class Chicken extends Animal{
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 4, "generic");
$this->setName('Chicken');
$this->setSpeed(0.25);
$this->update();
}
public function isFood($id){
return $id === PUMPKIN_SEEDS || $id === MELON_SEEDS || $id === BEETROOT_SEEDS || $id === WHEAT_SEEDS;
@ -18,8 +17,8 @@ class Chicken extends Animal{
public function fall(){} //chickens have no fall dmg?
public function update(){
parent::update();
public function update($now){
parent::update($now);
if($this->timeUntilEgg-- <= 0 && !$this->isBaby()){
$this->dropAnEgg();
$this->timeUntilEgg = mt_rand(0,6000) + 6000;

View file

@ -8,7 +8,6 @@ class Cow extends Animal{
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 10, "generic");
$this->setName("Cow");
$this->setSpeed(0.2);
$this->update();
}
public function isFood($id){

View file

@ -9,7 +9,6 @@ class Pig extends Animal implements Rideable{
$this->server = ServerAPI::request();
$this->setName("Pig");
$this->setSpeed(0.25);
$this->update();
}
/**
* @return boolean

View file

@ -3,6 +3,7 @@
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);
@ -11,9 +12,9 @@ class Sheep extends Animal{
$this->data["Sheared"] = isset($this->data["Sheared"]) ? $this->data["Sheared"] : 0;
$this->data["Color"] = isset($this->data["Color"]) ? $this->data["Color"] : $this->sheepColor();
$this->setSpeed(0.25);
$this->update();
$this->ai->addTask(new TaskEatTileGoal());
}
public function createSaveData(){
$data = parent::createSaveData();
$data["Color"] = @$this->data["Color"];