mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 04:59:46 +00:00
fixed chance
This commit is contained in:
parent
1ce5292981
commit
355c2167d1
3 changed files with 8 additions and 5 deletions
|
|
@ -42,7 +42,7 @@ class DirtBlock extends SolidBlock{
|
||||||
$this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);
|
$this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);
|
||||||
if($type === BLOCK_UPDATE_RANDOM){
|
if($type === BLOCK_UPDATE_RANDOM){
|
||||||
if(mt_rand(0, 3) == 0){
|
if(mt_rand(0, 3) == 0){
|
||||||
if(($this->getSide(1)->isTransparent === false) or ($this->getSide(1)->getID()->isLiquid) or ($this->getSide(1)->getID() == 60)) return false;
|
if(($this->getSide(1)->isTransparent === false) or ($this->getSide(1)->isLiquid) or ($this->getSide(1)->getID() == 60)) return false;
|
||||||
if($this->getGrassInRadius() == true){
|
if($this->getGrassInRadius() == true){
|
||||||
$this->level->setBlock($this, BlockAPI::get(GRASS, 0), true, false, true);
|
$this->level->setBlock($this, BlockAPI::get(GRASS, 0), true, false, true);
|
||||||
return BLOCK_UPDATE_RANDOM;
|
return BLOCK_UPDATE_RANDOM;
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ class GrassBlock extends SolidBlock{
|
||||||
ServerAPI::request()->api->entity->drop(new Position($this->x+0.5, $this->y+1, $this->z+0.5, $this->level), BlockAPI::getItem(458,0,1));
|
ServerAPI::request()->api->entity->drop(new Position($this->x+0.5, $this->y+1, $this->z+0.5, $this->level), BlockAPI::getItem(458,0,1));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elseif($chance <= 15){
|
elseif($chance > 1 and $chance <= 16){
|
||||||
ServerAPI::request()->api->entity->drop(new Position($this->x+0.5, $this->y+1, $this->z+0.5, $this->level), BlockAPI::getItem(295,0,1));
|
ServerAPI::request()->api->entity->drop(new Position($this->x+0.5, $this->y+1, $this->z+0.5, $this->level), BlockAPI::getItem(295,0,1));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -653,15 +653,18 @@ class Entity extends Position{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function sheepColor(){
|
public function sheepColor(){
|
||||||
|
$pink = 0.1558;
|
||||||
|
$brown = 2.85;
|
||||||
|
$lightgray_black_gray = 14.25;
|
||||||
$chance = Utils::randomFloat() * 100;
|
$chance = Utils::randomFloat() * 100;
|
||||||
switch($chance){
|
switch($chance){
|
||||||
case $chance <= 0.1558:
|
case($chance <= $pink):
|
||||||
$color = 6;
|
$color = 6;
|
||||||
break;
|
break;
|
||||||
case $chance <= 2.85:
|
case($chance > $pink and $chance <= ($brown+$pink)):
|
||||||
$color = 12;
|
$color = 12;
|
||||||
break;
|
break;
|
||||||
case $chance <= 4.75:
|
case($chance > ($brown+$pink) and $chance <= ($lightgray_black_gray+$brown+$pink)):
|
||||||
$rand = mt_rand(1,3);
|
$rand = mt_rand(1,3);
|
||||||
if($rand == 1) $color = 15;
|
if($rand == 1) $color = 15;
|
||||||
elseif($rand == 2) $color = 7;
|
elseif($rand == 2) $color = 7;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue