Don't bother doing null checks for block copy

This will never be null if the block factory was initialized correctly. This will also cause a crash if bugs like e88053faf452df60262aad3e40c83dfed7f5dfa3 occur again in the future instead of silently causing unexpected behaviour.
This commit is contained in:
Dylan K. Taylor 2017-08-19 21:29:24 +01:00
parent e88053faf4
commit bed68a012d

View File

@ -377,12 +377,7 @@ class Block extends Position implements BlockIds, Metadatable{
*/
public static function get(int $id, int $meta = 0, Position $pos = null) : Block{
try{
$block = self::$fullList[($id << 4) | $meta];
if($block !== null){
$block = clone $block;
}else{
$block = new UnknownBlock($id, $meta);
}
$block = clone self::$fullList[($id << 4) | $meta];
}catch(\RuntimeException $e){
//TODO: this probably should return null (out of bounds IDs may cause unexpected behaviour)
$block = new UnknownBlock($id, $meta);