mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
more stuff uses StaticBlock class now
This commit is contained in:
parent
9cb7fbafaa
commit
e70c501df8
12 changed files with 49 additions and 86 deletions
|
|
@ -61,8 +61,9 @@ class NetherReactorBlock extends SolidBlock{
|
|||
for($a = $aOne; $a < $aTwo; $a += $aThree) { //wth those cycles are? TODO simplify if possible(makes server lag)
|
||||
for($b = $bOne; $b < $bTwo; $b += $bThree) {
|
||||
for($c = $cOne; $c < $cTwo; $c += $cThree) {
|
||||
if ($this->level->getBlock(new Vector3($x+$a, $y+$b, $z+$c))->getID() === 87 && Utils::randomFloat() > 0.75){
|
||||
$this->level->setBlock(new Vector3($x+$a, $y+$b, $z+$c), new AirBlock());
|
||||
if ($this->level->level->getBlockID($x+$a, $y+$b, $z+$c) === NETHERRACK && Utils::randomFloat() > 0.75){
|
||||
//$this->level->setBlock(new Vector3($x+$a, $y+$b, $z+$c), new AirBlock());
|
||||
$this->level->fastSetBlockUpdate($x+$a, $y+$b, $z+$c, 0, 0); //TODO might be better to set not directly?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -188,7 +189,7 @@ class NetherReactorBlock extends SolidBlock{
|
|||
foreach($this->core as $yOffset => $layer){
|
||||
foreach($layer as $line){
|
||||
foreach(str_split($line) as $char){
|
||||
$b = $this->level->getBlock(new Vector3($x + $offsetX, $y + $yOffset, $z + $offsetZ))->getID();
|
||||
$b = $this->level->level->getBlockID($x + $offsetX, $y + $yOffset, $z + $offsetZ);
|
||||
switch($char){
|
||||
case "G":
|
||||
if($b === GOLD_BLOCK){ //TODO make it use structure class
|
||||
|
|
@ -201,7 +202,7 @@ class NetherReactorBlock extends SolidBlock{
|
|||
}
|
||||
return false;
|
||||
case "R":
|
||||
if($b === NETHER_REACTOR and $this->level->getBlock(new Vector3($x + $offsetX, $y + $yOffset, $z + $offsetZ))->getMetadata() === 0){
|
||||
if($b === NETHER_REACTOR and $this->level->level->getBlockDamage($x + $offsetX, $y + $yOffset, $z + $offsetZ) === 0){
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -210,8 +211,6 @@ class NetherReactorBlock extends SolidBlock{
|
|||
break;
|
||||
}
|
||||
return false;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
++$offsetX;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,17 +18,17 @@ class FarmlandBlock extends TransparentBlock{
|
|||
|
||||
public static function onRandomTick(Level $level, $x, $y, $z){
|
||||
$meta = $level->level->getBlockDamage($x, $y, $z);
|
||||
$b = $level->getBlockWithoutVector($x, $y + 1, $z, $level, false);
|
||||
$b = $level->level->getBlockID($x, $y + 1, $z);
|
||||
if($meta === 0 && mt_rand(0, 5) === 0){
|
||||
$water = self::checkWaterStatic($level, $x, $y, $z);
|
||||
if($water){
|
||||
$level->setBlock(new Position($x, $y, $z, $level), BlockAPI::get(FARMLAND, 1), true, false, true);
|
||||
}elseif(!(($b instanceof Block) && $b->isTransparent && $b->id != 0)){
|
||||
}elseif($b != 0 && StaticBlock::getIsTransparent($b)){
|
||||
$level->setBlock(new Position($x, $y, $z, $level), BlockAPI::get(DIRT, 0), true, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
if($b instanceof Block && !$b->isFlowable){
|
||||
if(!StaticBlock::getIsFlowable($b)){
|
||||
$level->setBlock(new Position($x, $y, $z, $level), BlockAPI::get(DIRT, 0), true, false, true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class GrassBlock extends SolidBlock{
|
|||
return;
|
||||
}
|
||||
public static function onRandomTick(Level $level, $x, $y, $z){
|
||||
if(!$level->getBlockWithoutVector($x, $y + 1, $z, false)->isTransparent && mt_rand(0, 2) == 1){
|
||||
if(!StaticBlock::getIsTransparent($level->level->getBlockID($x, $y + 1, $z)) && mt_rand(0, 2) == 1){
|
||||
$level->fastSetBlockUpdate($x, $y, $z, DIRT, 0);
|
||||
}else{
|
||||
for($cnt = 0; $cnt < 4; ++$cnt){
|
||||
|
|
@ -55,8 +55,8 @@ class GrassBlock extends SolidBlock{
|
|||
$y = $y + mt_rand(0, 4) - 3;
|
||||
$z = $z + mt_rand(0, 2) - 1;
|
||||
|
||||
$blockUp = $level->getBlockWithoutVector($x, $y + 1, $z, false);
|
||||
if($blockUp->isTransparent && !$blockUp->isLiquid && !($blockUp->getID() === 60) && $level->level->getBlockID($x, $y, $z) === DIRT){
|
||||
$blockUp = $level->level->getBlockID($x, $y + 1, $z);
|
||||
if(StaticBlock::getIsTransparent($blockUp) && !StaticBlock::getIsLiquid($blockUp) && !($blockUp === 60) && $level->level->getBlockID($x, $y, $z) === DIRT){
|
||||
$level->fastSetBlockUpdate($x, $y, $z, GRASS, 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ class LeavesBlock extends TransparentBlock{
|
|||
}
|
||||
$visited[$index] = true;
|
||||
|
||||
$block = $level->getBlockWithoutVector($x, $y, $z, false);
|
||||
if($block instanceof WoodBlock){ //type doesn't matter
|
||||
$block = $level->level->getBlockID($x, $y, $z);
|
||||
if($block === WOOD){ //type doesn't matter
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue