mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-23 00:55:57 +00:00
Fixed possible Level::getBlock() crash
This commit is contained in:
parent
afa98866e0
commit
9e5e4fb362
@ -733,8 +733,8 @@ class Level implements ChunkManager, Metadatable{
|
||||
public function getBlock(Vector3 $pos){
|
||||
$blockId = 0;
|
||||
$meta = 0;
|
||||
if($pos->y >= 0 and $pos->y < 128){
|
||||
$this->getChunkAt($pos->x >> 4, $pos->z >> 4, true)->getBlock($pos->x & 0x0f, $pos->y & 0x7f, $pos->z & 0x0f, $blockId, $meta);
|
||||
if($pos->y >= 0 and $pos->y < 128 and ($chunk = $this->getChunkAt($pos->x >> 4, $pos->z >> 4, true)) !== null){
|
||||
$chunk->getBlock($pos->x & 0x0f, $pos->y & 0x7f, $pos->z & 0x0f, $blockId, $meta);
|
||||
}
|
||||
|
||||
if($blockId === 0){
|
||||
|
@ -105,7 +105,7 @@ abstract class BaseChunk extends BaseFullChunk implements Chunk{
|
||||
if(!isset($nbt->id)){
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//TODO: add all entities
|
||||
if($nbt->id instanceof String){ //New format
|
||||
switch($nbt["id"]){
|
||||
|
Loading…
x
Reference in New Issue
Block a user