42 return ItemUseResult::NONE;
48 foreach(PaintingMotive::getAll() as $motive){
49 $currentTotalDimension = $motive->getHeight() + $motive->getWidth();
50 if($currentTotalDimension < $totalDimension){
54 if(Painting::canFit($player->getWorld(), $blockReplace->getPosition(), $face,
true, $motive)){
55 if($currentTotalDimension > $totalDimension){
56 $totalDimension = $currentTotalDimension;
69 if(count($motives) === 0){
70 return ItemUseResult::NONE;
74 $motive = $motives[array_rand($motives)];
76 $replacePos = $blockReplace->getPosition();
77 $clickedPos = $blockClicked->getPosition();
79 $entity =
new Painting(Location::fromObject($replacePos, $replacePos->getWorld()), $clickedPos, $face, $motive);
81 $entity->spawnToAll();
83 $player->getWorld()->addSound($replacePos->add(0.5, 0.5, 0.5),
new PaintingPlaceSound());
84 return ItemUseResult::SUCCESS;