Fixed incorrect parameter checking in BlockFactory::get() (#4476)

This commit is contained in:
Leo Lee 2021-09-24 22:47:11 +08:00 committed by GitHub
parent 1cb540387c
commit eb80515e99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -952,7 +952,7 @@ class BlockFactory{
* Deserializes a block from the provided legacy ID and legacy meta.
*/
public function get(int $id, int $meta) : Block{
if($meta < 0 or $meta > (1 << Block::INTERNAL_METADATA_BITS)){
if($meta < 0 or $meta >= (1 << Block::INTERNAL_METADATA_BITS)){
throw new \InvalidArgumentException("Block meta value $meta is out of bounds");
}