From bdbb548ee67e32230d0869116919de7298fc9426 Mon Sep 17 00:00:00 2001 From: ArkQuark <74979909+ArkQuark@users.noreply.github.com> Date: Thu, 2 Jun 2022 20:57:22 +0300 Subject: [PATCH] fix utils::chance() --- src/material/item/generic/SpawnEgg.php | 4 ++-- src/utils/Utils.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/material/item/generic/SpawnEgg.php b/src/material/item/generic/SpawnEgg.php index a0f774de..6ee32f8f 100644 --- a/src/material/item/generic/SpawnEgg.php +++ b/src/material/item/generic/SpawnEgg.php @@ -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); diff --git a/src/utils/Utils.php b/src/utils/Utils.php index e4fdddb3..3d9985ef 100644 --- a/src/utils/Utils.php +++ b/src/utils/Utils.php @@ -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){