40 $pos = $blockClicked->getPosition();
41 $world = $pos->getWorld();
42 $bb = AxisAlignedBB::one()
43 ->offset($pos->getX(), $pos->getY(), $pos->getZ())
44 ->extend(Facing::UP, 1);
46 count($world->getNearbyEntities($bb)) === 0 &&
47 $blockClicked->
getSide(Facing::UP)->getTypeId() === BlockTypeIds::AIR &&
48 $blockClicked->
getSide(Facing::UP, 2)->getTypeId() === BlockTypeIds::AIR
50 $crystal =
new EntityEndCrystal(Location::fromObject($pos->add(0.5, 1, 0.5), $world));
51 $crystal->spawnToAll();
54 return ItemUseResult::SUCCESS;
57 return ItemUseResult::NONE;