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{ public function onActivate(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : bool{
if(!$blockClicked->isTransparent() and $face > 1 and !$blockReplace->isSolid()){ if($face === Vector3::SIDE_DOWN or $face === Vector3::SIDE_UP){
/** @var PaintingMotive[] $motives */ return false;
}
$motives = []; $motives = [];
$totalDimension = 0; $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 $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 true;
} }
}
return false; return false;
} }