mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
removed some useless stuff from explosion, onPlace should be called every ti
This commit is contained in:
parent
9c21a984cd
commit
5d5099c06f
3 changed files with 17 additions and 15 deletions
|
|
@ -203,7 +203,7 @@ class LiquidBlockDynamic extends LiquidBlock{
|
|||
$flags = static::getSpread($level, $x, $y, $z);
|
||||
$k1 = $depth >= 8 ? 1 : ($depth + $flowAdd);
|
||||
if($k1 >= 8) return;
|
||||
//TODO flags are broken, no flags makes too much of the liquid
|
||||
|
||||
if($flags[0]) static::trySpreadTo($level, $x - 1, $y, $z, $k1);
|
||||
if($flags[1]) static::trySpreadTo($level, $x + 1, $y, $z, $k1);
|
||||
if($flags[2]) static::trySpreadTo($level, $x, $y, $z - 1, $k1);
|
||||
|
|
|
|||
|
|
@ -369,7 +369,14 @@ class PMFLevel extends PMF{
|
|||
$aX = $x & 0xf;
|
||||
$aZ = $z & 0xf;
|
||||
$aY = $y & 0xf;
|
||||
$this->chunks[$index][$Y][(int) ($aY + ($aX << 5) + ($aZ << 9))] = chr($block);
|
||||
$bind = (int) ($aY + ($aX << 5) + ($aZ << 9));
|
||||
if($this->chunks[$index][$Y][$bind] == chr($block)){
|
||||
return false; //no changes done
|
||||
}else{
|
||||
$this->chunks[$index][$Y][$bind] = chr($block);
|
||||
if($block > 0) StaticBlock::getBlock($block)::onPlace($this->level, $x, $y, $z);
|
||||
}
|
||||
|
||||
if(!isset($this->chunkChange[$index][$Y])){
|
||||
$this->chunkChange[$index][$Y] = 1;
|
||||
}else{
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class Explosion{
|
|||
$this->nullPlayer = new PlayerNull();
|
||||
}
|
||||
|
||||
public function sub_expl(&$visited, $i, $mRays, $j, $k){
|
||||
public function sub_expl($i, $mRays, $j, $k){
|
||||
$vector = new Vector3($i / $mRays * 2 - 1, $j / $mRays * 2 - 1, $k / $mRays * 2 - 1); //($i / $mRays) * 2 - 1
|
||||
$vector = $vector->normalize()->multiply($this->stepLen);
|
||||
$pointer = clone $this->source;
|
||||
|
|
@ -39,11 +39,6 @@ class Explosion{
|
|||
$blockMeta = $BIDM[1];
|
||||
if($blockID > 0){
|
||||
$index = ($vBlock->x << 16) + ($vBlock->z << 8) + $vBlock->y;
|
||||
|
||||
if(StaticBlock::getIsLiquid($blockID) && !isset($visited[$index])){
|
||||
$visited[$index] = true;
|
||||
}
|
||||
|
||||
$blastForce -= (StaticBlock::getHardness($blockID) / 5 + 0.3) * $this->stepLen;
|
||||
if($blastForce > 0){
|
||||
if(!isset($this->affectedBlocks[$index])){
|
||||
|
|
@ -102,45 +97,45 @@ class Explosion{
|
|||
]) === false){
|
||||
return false;
|
||||
}
|
||||
$visited = [];
|
||||
|
||||
$mRays = $this->rays - 1;
|
||||
$i = 0;
|
||||
for($j = 0; $j <= $mRays; ++$j){
|
||||
for($k = 0; $k <= $mRays; ++$k){
|
||||
$this->sub_expl($visited, $i, $mRays, $j, $k); //i wish there was #define or inline
|
||||
$this->sub_expl($i, $mRays, $j, $k); //i wish there was #define or inline
|
||||
}
|
||||
}
|
||||
$i = $mRays;
|
||||
for($j = 0; $j <= $mRays; ++$j){
|
||||
for($k = 0; $k <= $mRays; ++$k){
|
||||
$this->sub_expl($visited, $i, $mRays, $j, $k);
|
||||
$this->sub_expl($i, $mRays, $j, $k);
|
||||
}
|
||||
}
|
||||
|
||||
$j = 0;
|
||||
for($i = 1; $i < $mRays; ++$i){
|
||||
for($k = 0; $k <= $mRays; ++$k){
|
||||
$this->sub_expl($visited, $i, $mRays, $j, $k);
|
||||
$this->sub_expl($i, $mRays, $j, $k);
|
||||
}
|
||||
}
|
||||
|
||||
$j = $mRays;
|
||||
for($i = 1; $i < $mRays; ++$i){
|
||||
for($k = 0; $k <= $mRays; ++$k){
|
||||
$this->sub_expl($visited, $i, $mRays, $j, $k);
|
||||
$this->sub_expl($i, $mRays, $j, $k);
|
||||
}
|
||||
}
|
||||
|
||||
$k = 0;
|
||||
for($i = 1; $i < $mRays; ++$i){
|
||||
for($j = 1; $j < $mRays; ++$j){
|
||||
$this->sub_expl($visited, $i, $mRays, $j, $k);
|
||||
$this->sub_expl($i, $mRays, $j, $k);
|
||||
}
|
||||
}
|
||||
$k = $mRays;
|
||||
for($i = 1; $i < $mRays; ++$i){
|
||||
for($j = 1; $j < $mRays; ++$j){
|
||||
$this->sub_expl($visited, $i, $mRays, $j, $k);
|
||||
$this->sub_expl($i, $mRays, $j, $k);
|
||||
}
|
||||
}
|
||||
//if($i == 0 or $i == $mRays or $j == 0 or $j == $mRays or $k == 0 or $k == $mRays){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue