mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-21 02:44:03 +00:00
Fix for explosions modifying the wrong subchunks under some circumstances
This commit is contained in:
parent
f477cfa1bf
commit
c1a6711514
@ -78,10 +78,11 @@ class Explosion{
|
|||||||
|
|
||||||
$currentX = ((int) $this->source->x) >> 4;
|
$currentX = ((int) $this->source->x) >> 4;
|
||||||
$currentZ = ((int) $this->source->z) >> 4;
|
$currentZ = ((int) $this->source->z) >> 4;
|
||||||
$currentChunk = $this->level->getChunk($currentX, $currentZ, true);
|
|
||||||
|
|
||||||
$currentSubY = ((int) $this->source->y) >> 4;
|
$currentSubY = ((int) $this->source->y) >> 4;
|
||||||
$currentSubChunk = $currentChunk->getSubChunk($currentSubY);
|
|
||||||
|
$currentChunk = null;
|
||||||
|
$currentSubChunk = null;
|
||||||
|
|
||||||
$mRays = (int) ($this->rays - 1);
|
$mRays = (int) ($this->rays - 1);
|
||||||
for($i = 0; $i < $this->rays; ++$i){
|
for($i = 0; $i < $this->rays; ++$i){
|
||||||
@ -103,9 +104,10 @@ class Explosion{
|
|||||||
$vBlock->z = $pointerZ >= $z ? $z : $z - 1;
|
$vBlock->z = $pointerZ >= $z ? $z : $z - 1;
|
||||||
|
|
||||||
|
|
||||||
if(($vBlock->x >> 4) !== $currentX or ($vBlock->z >> 4) !== $currentZ){
|
if($currentChunk === null or ($vBlock->x >> 4) !== $currentX or ($vBlock->z >> 4) !== $currentZ){
|
||||||
$currentX = $vBlock->x >> 4;
|
$currentX = $vBlock->x >> 4;
|
||||||
$currentZ = $vBlock->z >> 4;
|
$currentZ = $vBlock->z >> 4;
|
||||||
|
$currentSubChunk = null;
|
||||||
|
|
||||||
$currentChunk = $this->level->getChunk($currentX, $currentZ);
|
$currentChunk = $this->level->getChunk($currentX, $currentZ);
|
||||||
if($currentChunk === null){
|
if($currentChunk === null){
|
||||||
@ -113,7 +115,7 @@ class Explosion{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(($vBlock->y >> 4) !== $currentSubY){
|
if($currentSubChunk === null or ($vBlock->y >> 4) !== $currentSubY){
|
||||||
$currentSubY = $vBlock->y >> 4;
|
$currentSubY = $vBlock->y >> 4;
|
||||||
$currentSubChunk = $currentChunk->getSubChunk($currentSubY);
|
$currentSubChunk = $currentChunk->getSubChunk($currentSubY);
|
||||||
if($currentSubChunk === null){
|
if($currentSubChunk === null){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user