added StaticBlock

This commit is contained in:
GameHerobrine 2023-08-16 19:22:05 +03:00
parent 0b28ed8042
commit c6c088a7d5
7 changed files with 211 additions and 23 deletions

View file

@ -101,12 +101,7 @@ class Level{
if(!isset($this->level)){
return false;
}
/*if(ADVANCED_CACHE == true){
$identifier = "world:{$this->name}:$X:$Z";
if(($cache = Cache::get($identifier)) !== false){
return $cache;
}
}*/
$gen = $this->generatorType === 1 || !($X > 15 || $X < 0 || $Z > 15 || $Z < 0);
$orderedIds = "";
$orderedData = "";
@ -149,7 +144,7 @@ class Level{
}
$nbt = new NBT_new(NBT_new::LITTLE_ENDIAN);
foreach($chunkTiles as $tile){
foreach($chunkTiles as $tile){ //TODO non-hardcoded nbt data
switch($tile->class){
case "Sign":
$text = $tile->getText();
@ -183,9 +178,6 @@ class Level{
$orderedIds . $orderedData . $orderedSkyLight . $orderedLight .
$orderedBiomeIds . $orderedBiomeColors . $tileEntities;
$ordered = zlib_encode($orderedUncompressed, ZLIB_ENCODING_DEFLATE, 6);
/*if(ADVANCED_CACHE == true){
Cache::add($identifier, $ordered, 60);
}*/
return $ordered;
}

View file

@ -14,7 +14,7 @@ class GroundCover extends Populator
if(count($cover) > 0){
$diffY = 0;
if(!BlockAPI::get($cover[0][0], $cover[0][1])->isSolid){
if(!StaticBlock::getIsSolid($cover[0][0])){
$diffY = 1;
}
@ -22,7 +22,7 @@ class GroundCover extends Populator
for($y = 127; $y > 0; --$y){
$chunkY = $y >> 4;
$b = $column[$chunkY][(($y & 0xf) + ($x << 6) + ($z << 10))];
if($b !== "\x00" and !BlockAPI::get(ord($b))->isTransparent){
if($b !== "\x00" and !StaticBlock::getIsTransparent(ord($b))){
break;
}
}
@ -31,20 +31,17 @@ class GroundCover extends Populator
for($y = $startY; $y > $endY and $y >= 0; --$y){
$chunkY = $y >> 4;
$pair = $cover[$startY - $y];
$b = BlockAPI::get($pair[0], $pair[1]);
if($column[$chunkY][(($y & 0xf) + ($x << 6) + ($z << 10))] === "\x00" and $b->isSolid){
//$b = BlockAPI::get($pair[0], $pair[1]);
$bid = $pair[0];
$bmeta = $pair[1];
if($column[$chunkY][(($y & 0xf) + ($x << 6) + ($z << 10))] === "\x00" and StaticBlock::getIsSolid($bid)){
break;
}
if($y <= $waterHeight and $b->getID() == GRASS and $level->level->getBlockID($pcx, $y + 1, $pcz) == STILL_WATER){
//$b = BlockAPI::get(DIRT);
if($y <= $waterHeight and $bid == GRASS and $level->level->getBlockID($pcx, $y + 1, $pcz) == STILL_WATER){
$level->level->setBlock($pcx, $y, $pcz, DIRT, 0);
continue;
}
//if($b->getMetadata() === 0){
// $level->level->setBlockId($pcx, $y, $pcz, $b->getID());
//}else{
$level->level->setBlock($pcx, $y, $pcz, $b->getID(), $b->getMetadata());
//}
$level->level->setBlock($pcx, $y, $pcz, $bid, $bmeta);
}
}
}

View file

@ -48,7 +48,6 @@ class TallGrassPopulator extends Populator{
}else{
$this->level->level->setBlock($xx, $yy, $zz, TALL_GRASS, 1);
}
}
}
}
@ -59,7 +58,6 @@ class TallGrassPopulator extends Populator{
}
private function getHighestWorkableBlock($x, $z){
for($y = 128; $y > 0; --$y){
$b = $this->level->level->getBlockID($x, $y, $z);
if($b == GRASS){