mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-11 04:17:48 +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){
|
public function getBlock(Vector3 $pos){
|
||||||
$blockId = 0;
|
$blockId = 0;
|
||||||
$meta = 0;
|
$meta = 0;
|
||||||
if($pos->y >= 0 and $pos->y < 128){
|
if($pos->y >= 0 and $pos->y < 128 and ($chunk = $this->getChunkAt($pos->x >> 4, $pos->z >> 4, true)) !== null){
|
||||||
$this->getChunkAt($pos->x >> 4, $pos->z >> 4, true)->getBlock($pos->x & 0x0f, $pos->y & 0x7f, $pos->z & 0x0f, $blockId, $meta);
|
$chunk->getBlock($pos->x & 0x0f, $pos->y & 0x7f, $pos->z & 0x0f, $blockId, $meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($blockId === 0){
|
if($blockId === 0){
|
||||||
|
@ -105,7 +105,7 @@ abstract class BaseChunk extends BaseFullChunk implements Chunk{
|
|||||||
if(!isset($nbt->id)){
|
if(!isset($nbt->id)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: add all entities
|
//TODO: add all entities
|
||||||
if($nbt->id instanceof String){ //New format
|
if($nbt->id instanceof String){ //New format
|
||||||
switch($nbt["id"]){
|
switch($nbt["id"]){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user