World: do not attempt placement of itemblock if stack size is zero (#4410)

This doesn't make any sense, and also caused a crash.
This commit is contained in:
marshall 2021-08-27 20:14:56 +08:00 committed by GitHub
parent d9b9aed2cc
commit ee16a00c57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1780,12 +1780,11 @@ class World implements ChunkManager{
return true;
}
if($item->canBePlaced()){
$hand = $item->getBlock($face);
$hand->position($this, $blockReplace->getPosition()->x, $blockReplace->getPosition()->y, $blockReplace->getPosition()->z);
}else{
if($item->isNull() or !$item->canBePlaced()){
return false;
}
$hand = $item->getBlock($face);
$hand->position($this, $blockReplace->getPosition()->x, $blockReplace->getPosition()->y, $blockReplace->getPosition()->z);
if($hand->canBePlacedAt($blockClicked, $clickVector, $face, true)){
$blockReplace = $blockClicked;