function pathfindEntity(target: entity, mob: entity type): loop all entities: if name of loop-entity is "&eZwierzak %{_target}%": stop spawn {_mob} at {_target} set the display name of the spawned entity to "&eZwierzak %{_target}%" while {_target} is alive: loop all entities: if name of loop-entity is "&eZwierzak %{_target}%": if distance between {_target} and loop-entity < 15: if distance between {_target} and loop-entity > 3: make loop-entity pathfind to {_target} with speed 1.3 else if distance between {_target} and loop-entity > 15: teleport loop-entity to {_target} if world of {_target} is not world of loop-entity: teleport loop-entity to {_target} wait 10 tick delete spawned entity