Hello everyone! I just create a function to check that block is in corner or not (true false). I was tried a method with checking (X + 1), (X - 1), (Z + 1), (Z - 1), but its not accurate, maybe my algorithm did it wrongly. this is my algo: PHP: public function isCorner(Block $b) : bool { $x = (int) $b->getX(); $y = (int) $b->getY(); $z = (int) $b->getZ(); $l = $b->getLevel(); var_dump($x); var_dump($y); var_dump($z); $id = $b->getId(); if ($l->getBlockIdAt($x + 1, $y, $z) == $id && $l->getBlockIdAt($x - 1, $y, $z) !== $id) { echo "if ke 1\n"; if ($l->getBlockIdAt($x, $y, $z + 1) == $id && $l->getBlockIdAt($x, $y, $z - 1) !== $id) { return true; } elseif ($l->getBlockIdAt($x, $y, $z - 1) == $id && $l->getBlockIdAt($x, $y, $z + 1) !== $id) { return true; } else { return false; } } elseif ($l->getBlockIdAt($x - 1, $y, $z) == $id && $l->getBlockIdAt($x + 1, $y, $z) !== $id) { echo "if ke 2\n"; if ($l->getBlockIdAt($x, $y, $z + 1) == $id && $l->getBlockIdAt($x, $y, $z - 1) !== $id) { return true; } elseif ($l->getBlockIdAt($x, $y, $z - 1) == $id && $l->getBlockIdAt($x, $y, $z + 1) !== $id) { return true; } else { return false; } } else { echo "if ke 3\n"; return false; } } when i debugging, all if are called (if ke 1, if ke 2, if ke 3) but always return to false. then i try other way, i use Block::getSide(); but im not sure if it can really works with. so please, tell me about Block::getSide() what is first parameter and second parameter for? or tell me what should i change from my code to get more accurate calculation.
EDITED: okay i got it. PHP: const SIDE_DOWN = 0; const SIDE_UP = 1; const SIDE_NORTH = 2; const SIDE_SOUTH = 3; const SIDE_WEST = 4; const SIDE_EAST = 5; so i need someone to explain where is my fault on my own function?