PHP: $mobpos = new Vector3(x, y, z);$mob = //mobobjectpublic function onMove(PlayerMoveEvent $event){$p = $event->getPlayer();if(!in_array($mob, $p->getLevel()->getEntities()) return;foreach($p->getLevel()->getEntities() as $e){if($mob === $e){if($mobpos != $e->getPosition()) $e->teleport($mobpos);}}}
You can't prevent mobs from sliding, because mobs don't slide at all. It is only client-side. You just need to resend the entity positions. You don't need to be at the exactly same position as the mob. Due to the nature of double precision floating points, it is basically impossible that two entities are at the same place unless you teleport them together. You should use the AxisAlignedBB methods from Entity::getBoundingBox(). You only want to prevent collision with $mob, but you handle a PlayerMoveEvent, and then you check all entities in that level rather than only that player. What's the sense of using $p then? Just respawn the entity whenever collision with player is detected. PHP: public function onMove(PlayerMoveEvent $event){ $player = $event->getPlayer(); // provided: $mob the mob that is moved if($player->getBoundingBox()->intersectsWith($mob)){ $mob->despawnFrom($player); $mob->spawnTo($player); }}