22declare(strict_types=1);
24namespace pocketmine\block\utils;
26enum ChiseledBookshelfSlot :
int{
31 case BOTTOM_MIDDLE = 4;
32 case BOTTOM_RIGHT = 5;
34 private const SLOTS_PER_SHELF = 3;
36 public static function fromBlockFaceCoordinates(
float $x,
float $y) : self{
38 throw new \InvalidArgumentException(
"X must be between 0 and 1, got $x");
41 throw new \InvalidArgumentException(
"Y must be between 0 and 1, got $y");
44 $slot = ($y < 0.5 ? self::SLOTS_PER_SHELF : 0) + match(
true){
51 return self::from($slot);