mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
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:
parent
e88053faf4
commit
bed68a012d
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user