mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-24 05:29:44 +00:00
fix utils::chance()
This commit is contained in:
parent
0e11e4c10e
commit
bdbb548ee6
2 changed files with 3 additions and 3 deletions
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
class SpawnEggItem extends Item{
|
class SpawnEggItem extends Item{
|
||||||
public function __construct($meta = 0, $count = 1){
|
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->meta = $meta;
|
||||||
$this->isActivable = true;
|
$this->isActivable = true;
|
||||||
}
|
}
|
||||||
|
|
@ -43,7 +43,7 @@ class SpawnEggItem extends Item{
|
||||||
"x" => $block->x + 0.5,
|
"x" => $block->x + 0.5,
|
||||||
"y" => $block->y,
|
"y" => $block->y,
|
||||||
"z" => $block->z + 0.5,
|
"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);
|
$e = ServerAPI::request()->api->entity->add($block->level, ENTITY_MOB, $this->meta, $data);
|
||||||
ServerAPI::request()->api->entity->spawnToAll($e);
|
ServerAPI::request()->api->entity->spawnToAll($e);
|
||||||
|
|
|
||||||
|
|
@ -385,7 +385,7 @@ class Utils{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function chance($i){//GameHerobrine's code
|
public static function chance($i){//GameHerobrine's code
|
||||||
return randomFloat() < $i / 100;
|
return self::randomFloat() < $i / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function round($number){
|
public static function round($number){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue