fix utils::chance()

This commit is contained in:
ArkQuark 2022-06-02 20:57:22 +03:00
parent 0e11e4c10e
commit bdbb548ee6
2 changed files with 3 additions and 3 deletions

View file

@ -21,7 +21,7 @@
class SpawnEggItem extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(SPAWN_EGG, 0, $count, "Spawn Egg");
parent::__construct(SPAWN_EGG, $meta, $count, "Spawn Egg");
$this->meta = $meta;
$this->isActivable = true;
}
@ -43,7 +43,7 @@ class SpawnEggItem extends Item{
"x" => $block->x + 0.5,
"y" => $block->y,
"z" => $block->z + 0.5,
"isBaby" => $ageable ? mt_rand(0,20) === 0 ? 1 : 0 : 0,
"isBaby" => $ageable ? Utils::chance(5) ? 1 : 0 : 0,
);
$e = ServerAPI::request()->api->entity->add($block->level, ENTITY_MOB, $this->meta, $data);
ServerAPI::request()->api->entity->spawnToAll($e);

View file

@ -385,7 +385,7 @@ class Utils{
}
public static function chance($i){//GameHerobrine's code
return randomFloat() < $i / 100;
return self::randomFloat() < $i / 100;
}
public static function round($number){