This commit is contained in:
PEMapModder 2016-03-06 23:13:33 +08:00
parent 95abec1886
commit 781de3efab

View File

@ -1236,6 +1236,7 @@ class Level implements ChunkManager, Metadatable{
* @return Block
*/
public function getBlock(Vector3 $pos, $cached = true) : Block{
$pos = $pos->floor();
$index = Level::blockHash($pos->x, $pos->y, $pos->z);
if($cached and isset($this->blockCache[$index])){
return $this->blockCache[$index];
@ -1370,6 +1371,7 @@ class Level implements ChunkManager, Metadatable{
* @return bool Whether the block has been updated or not
*/
public function setBlock(Vector3 $pos, Block $block, bool $direct = false, bool $update = true) : bool{
$pos = $pos->floor();
if($pos->y < 0 or $pos->y >= 128){
return false;
}