Issues with mob collisions

I’m having a bit of trouble making my mobs collide with each other. I’ve managed to get tile collisions working, but not mob collisions. With the code I have I find that mobs partially collide with each other, sometimes they collide and other times they walk into each other.

Each mob calls move(int xa, int ya) when they want to move.

public void move(int xa, int ya){
		if(xa != 0 && ya != 0){
			move(xa, 0);
			move(0, ya);
			return;
		}	
				
		if(xa > 0) dir = 1;
		if(xa < 0) dir = 3;
		if(ya > 0) dir = 2;
		if(ya < 0) dir = 0;
		
		if(!tileCollision(xa, ya) && !mobCollision(xa, ya)){
				moving = true;
				x += xa;
				y += ya;
				return;
		}
	}

And this is the mobCollision method:

	public boolean mobCollision(int xa, int ya){
                //x & y values are the mob position.
		xa = xa + x;
		ya = ya + y;
		
		int x0 = xa + collision_w_offset;
		int y0 = ya + collision_h_offset;
		
		int x1 = xa + collision_width + collision_w_offset;
		int y1 = ya + collision_height + collision_h_offset;
		
		Mob m = dungeon.getMob(x0, y0, x1, y1, this);
		if(m != null) return true;

		return false;
	}

This is the dungeon.getMob method:

public Mob getMob(int x0, int y0, int x1, int y1, Mob mob){
		for(Mob m : mobs){
			if(m.equals(mob)) continue;
			
			int mx = m.getX() + m.getCollision_w_offset();
			int my = m.getY() + m.getCollision_h_offset();
			int mw = mx + m.getCollision_width();
			int mh = my + m.getCollision_height();
			
			if(x0 > mx && x0 < mw && y0 > my && y0 < mh) return m;
			if(x1 > mx && x1 < mw && y1 > my && y1 < mh) return m;
			
		}
		return null;
	}

The collision_width, collision_height, collision_w_offset, collision_h_offset variables effect where the collision box is. The yellow points represent the edges of the collision box.

The player (the badly drawn arrow) will collide when face on on certain axis, then it won’t collide when they slightly overlap. This is kinda tricky to explain. I tried using a for loop to check each pixel in the collision box to see if they intersect, but that was really not efficient.

EDIT: Slightly fixed.

I had to check all four corners of the collision box.

if(x0 > mx && x0 < mw && y0 > my && y0 < mh) return m;
			if(x1 > mx && x1 < mw && y1 > my && y1 < mh) return m;
			if(x0 > mx && x0 < mw && y1 > my && y1 < mh) return m;
			if(x1 > mx && x1 < mw && y0 > my && y0 < mh) return m;

The player can’t walk through mobs but mobs CAN walk through the player & other mobs, any ideas?

EDIT 2: I’m a moron, the player wasn’t included in the mobs ArrayList.

Edit 3: I’ve found that mobs are still intersecting, if they are moving towards each other at the same time they will ignore collisions. Any idea why?