Painting: clean up guard checks, remove unnecessary checks

This commit is contained in:
Dylan K. Taylor 2018-11-29 19:29:10 +00:00
parent 93c26a0b0c
commit 60dddcd12a

View File

@ -37,8 +37,10 @@ class PaintingItem extends Item{
}
public function onActivate(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : bool{
if(!$blockClicked->isTransparent() and $face > 1 and !$blockReplace->isSolid()){
/** @var PaintingMotive[] $motives */
if($face === Vector3::SIDE_DOWN or $face === Vector3::SIDE_UP){
return false;
}
$motives = [];
$totalDimension = 0;
@ -98,7 +100,6 @@ class PaintingItem extends Item{
$player->getLevel()->broadcastLevelEvent($blockReplace->add(0.5, 0.5, 0.5), LevelEventPacket::EVENT_SOUND_ITEMFRAME_PLACE); //item frame and painting have the same sound
return true;
}
}
return false;
}