block/Light: fixed placement when clicking on another light block

closes #5132
This commit is contained in:
Dylan K. Taylor 2022-07-06 14:23:32 +01:00
parent 46b79fbe85
commit 5c4288de01
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -58,6 +58,11 @@ final class Light extends Flowable{
public function canBeReplaced() : bool{ return true; }
public function canBePlacedAt(Block $blockReplace, Vector3 $clickVector, int $face, bool $isClickedBlock) : bool{
//light blocks behave like solid blocks when placing them on another light block
return $blockReplace->canBeReplaced() && $blockReplace->getTypeId() !== $this->getTypeId();
}
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
$this->level = $this->level === self::MAX_LIGHT_LEVEL ?
self::MIN_LIGHT_LEVEL :