Hello! How can I get block under the itemFrame? I'm hooking PlayerInteractEvent and when player clicks on the itemFrame I can do $event->getBlock(); to get the itemFrame-block. I even can get tile for this itemFrame. But I do not understand how can I decide to which block this itemFrame is connected? I feel its should be somehow easy. please help! Tnx in advance!
Oh. Found a solution. Rotation is stored as damage of the block So to find target block I have to do something like PHP: switch ($b->getDamage()) { case 0: $pos = $pos->add(-1); break; case 1: $pos = $pos->add(+1); break; case 2: $pos = $pos->add(0,0,-1); break; case 3: $pos = $pos->add(0,0,+1); break;}
I believe these constants in the Vector3 class could help. I'm not quite sure though. You could also use Vector3->getSide().