Mobs don't deal damage or even chase/"target" to other players/mobs on their team if friendly fire is disabled, regardless of normal aggressive behavior. But slimes and magma cubes still do damage on contact. They will not go after teammates directly, however they will still deal damage. Iron golems on the same team will sometimes retaliate when getting damaged by a slime/magma cube on the same team as well (but the iron golem will usually "forget" about it right after. It actually targeted and attacked a zombie on the team in question once, but I couldn't replicate it).
Steps To Reproduce:
- Create a new world with cheats on and a non-peaceful difficulty(Creative, Superflat, mob spawning off, non-peaceful works best)
- Create a new team and disable friendly fire, and add yourself to it
- Spawn a slime or magma cube
- Add it to the team created earlier
- If you are in creative mode, switch to survival mode. Then bump into the slime/magma cube. It will still deal damage.