Added UnknownBlock class, fixed not-yet-added blocks in imported worlds killing people, close #181

This commit is contained in:
Dylan K. Taylor 2017-02-21 11:46:44 +00:00
parent e2cdd9eddc
commit c6cf3458de
2 changed files with 31 additions and 3 deletions

View File

@ -276,7 +276,7 @@ class Block extends Position implements BlockIds, Metadatable{
}else{
self::$lightFilter[$id] = 1;
for($data = 0; $data < 16; ++$data){
self::$fullList[($id << 4) | $data] = new Block($id, $data);
self::$fullList[($id << 4) | $data] = new UnknownBlock($id, $data);
}
}
}
@ -296,10 +296,10 @@ class Block extends Position implements BlockIds, Metadatable{
if($block !== null){
$block = new $block($meta);
}else{
$block = new Block($id, $meta);
$block = new UnknownBlock($id, $meta);
}
}catch(\RuntimeException $e){
$block = new Block($id, $meta);
$block = new UnknownBlock($id, $meta);
}
if($pos !== null){

View File

@ -0,0 +1,28 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
class UnknownBlock extends Flowable{
}