mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 00:07:30 +00:00
Fixed Chunk tile indexes
This commit is contained in:
parent
0128a7aeb2
commit
1a5544f68c
@ -1369,7 +1369,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
$chunk = $this->getChunk($pos->x >> 4, $pos->z >> 4);
|
||||
|
||||
if($chunk instanceof FullChunk){
|
||||
return $chunk->getTile($pos->x & 0x0f, $pos->y & 0x7f, $pos->z & 0x0f);
|
||||
return $chunk->getTile($pos->x & 0x0f, $pos->y & 0xff, $pos->z & 0x0f);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -237,13 +237,13 @@ abstract class BaseFullChunk implements FullChunk{
|
||||
|
||||
public function addTile(Tile $tile){
|
||||
$this->tiles[$tile->getID()] = $tile;
|
||||
$this->tiles[(($tile->z & 0x0f) << 8) | (($tile->x & 0x0f) << 4) | ($tile->y & 0x7f)] = $tile;
|
||||
$this->tiles[(($tile->z & 0x0f) << 12) | (($tile->x & 0x0f) << 8) | ($tile->y & 0xff)] = $tile;
|
||||
$this->hasChanged = true;
|
||||
}
|
||||
|
||||
public function removeTile(Tile $tile){
|
||||
unset($this->tiles[$tile->getID()]);
|
||||
unset($this->tiles[(($tile->z & 0x0f) << 8) | (($tile->x & 0x0f) << 4) | ($tile->y & 0x7f)]);
|
||||
unset($this->tiles[(($tile->z & 0x0f) << 12) | (($tile->x & 0x0f) << 8) | ($tile->y & 0xff)]);
|
||||
$this->hasChanged = true;
|
||||
}
|
||||
|
||||
@ -256,7 +256,7 @@ abstract class BaseFullChunk implements FullChunk{
|
||||
}
|
||||
|
||||
public function getTile($x, $y, $z){
|
||||
$index = ($z << 8) | ($x << 4) | $y;
|
||||
$index = ($z << 12) | ($x << 8) | $y;
|
||||
return isset($this->tileList[$index]) ? $this->tileList[$index] : null;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user