The method you are looking for is in CraftLivingEntity