mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-12 21:05:12 +00:00
World: reduce code duplication for chunk coordinate calculation
This commit is contained in:
parent
51fbff204b
commit
a7d8a598e1
@ -1610,7 +1610,7 @@ class World implements ChunkManager{
|
|||||||
$block->writeStateToWorld();
|
$block->writeStateToWorld();
|
||||||
$pos = $block->getPosition();
|
$pos = $block->getPosition();
|
||||||
|
|
||||||
$chunkHash = World::chunkHash($x >> Chunk::COORD_BIT_SIZE, $z >> Chunk::COORD_BIT_SIZE);
|
$chunkHash = World::chunkHash($chunkX, $chunkZ);
|
||||||
$relativeBlockHash = World::chunkBlockHash($x, $y, $z);
|
$relativeBlockHash = World::chunkBlockHash($x, $y, $z);
|
||||||
|
|
||||||
unset($this->blockCache[$chunkHash][$relativeBlockHash]);
|
unset($this->blockCache[$chunkHash][$relativeBlockHash]);
|
||||||
@ -1620,7 +1620,7 @@ class World implements ChunkManager{
|
|||||||
}
|
}
|
||||||
$this->changedBlocks[$chunkHash][$relativeBlockHash] = $pos;
|
$this->changedBlocks[$chunkHash][$relativeBlockHash] = $pos;
|
||||||
|
|
||||||
foreach($this->getChunkListeners($x >> Chunk::COORD_BIT_SIZE, $z >> Chunk::COORD_BIT_SIZE) as $listener){
|
foreach($this->getChunkListeners($chunkX, $chunkZ) as $listener){
|
||||||
$listener->onBlockChanged($pos);
|
$listener->onBlockChanged($pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user