mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 04:29:43 +00:00
mobs wont spawn if brightness is too high, aditional file with world data for storing additional information
This commit is contained in:
parent
d1a724c143
commit
cd07581d49
4 changed files with 175 additions and 13 deletions
|
|
@ -88,7 +88,7 @@ class MobSpawner{
|
|||
$zMob = $z + mt_rand(-3, 3);
|
||||
|
||||
|
||||
$y = $this->getSafeY($xMob, $zMob, $grassOnly, $type >= 32 && $type <= 36 && $type != 35);
|
||||
$y = $this->getSafeY($xMob, $zMob, $grassOnly, $type >= 32 && $type <= 36 && $type != 35, $type >= 32 && $type <= 36);
|
||||
if(!$y || $y < 0){
|
||||
continue;
|
||||
}
|
||||
|
|
@ -125,7 +125,7 @@ class MobSpawner{
|
|||
];
|
||||
}
|
||||
|
||||
protected function getSafeY($x, $z, $grassOnly = false, $highMob = false){ //first safe block //TODO check boundingbox
|
||||
protected function getSafeY($x, $z, $grassOnly = false, $highMob = false, $isMonster = false){ //first safe block //TODO check boundingbox
|
||||
$allowed = [];
|
||||
for($y = 0; $y < 128; ++$y){
|
||||
$b = $this->level->level->getBlockID($x, $y, $z);
|
||||
|
|
@ -136,6 +136,9 @@ class MobSpawner{
|
|||
(StaticBlock::getIsSolid($b1) && (!$grassOnly || $b1 === GRASS) &&
|
||||
(!$highMob || !StaticBlock::getIsSolid($b2) && !StaticBlock::getIsLiquid($b2)))
|
||||
){
|
||||
if($isMonster && ($rb = $this->level->getRawBrightness($x, $y, $z)) > 8){ //dont spawn if too bright
|
||||
continue;
|
||||
}
|
||||
$allowed[] = $y;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue